Re: [SLUG] filenames with spaces

From: Steve (steve@szmidt.org)
Date: Fri May 07 2004 - 18:02:05 EDT


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Friday 07 May 2004 12:03 pm, Eben King wrote:
> On Fri, 7 May 2004, Logan Tygart wrote:
> > On Thu, 2004-05-06 at 22:48, Steve wrote:
> > <snip>
> >
> > > The problem is that there are spaces in the file and directory names
> > > which I inherited from a windows machine.
> >
> > <snip>
> >
> > Sounds like a job for a PERL script.
>
> Bah.
>
> find $Dir -name "*.wma" | while read filename ; do
> echo " $filename"
> mplayer -ao pcm "$filename"
> done
>
> If $Dir has a space in its name, you need to put it in "" too.

Thanks!

I like open lines as they are easier to read and modify.

The only thing wrong is that $filename needs / to cover each of the spaces
and symbols in the names. Pretty much every directory and song has both
spaces and symbols in their names. Ex:

/MyMusic/Creed/Human Clay/06 Faceless Man [US Version].wma

The code looks like this now:

Dir="/home/s/MyMusic"
CDir="`pwd`"
cd $Dir
i=1

find "$Dir" -name "*.wma" |xargs -0 while read song ; do
        echo "$i $song"
        #mplayer -ao pcm "$song"
        i=$(($i+1))
        if [ "`ls -l audiodump.wav|cut -d' ' -f6`" -gt "100" ] ;then
                echo "Converting to ogg"
        fi
        #sleep 2
        exit 0
done

cd "$CDir"

- --
Steve

"They that would give up essential liberty for temporary safety deserve
neither liberty nor safety."
                                Benjamin Franklin

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD4DBQFAnAdhljK16xgETzkRAuqsAKCBfSqYHg/4gP5agWKHbEnjGN/OMQCYxD/f
acwm6W65PpNf3HEB1jLEaQ==
=DrBA
-----END PGP SIGNATURE-----

-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 17:54:42 EDT