[clug] Spaces in filenames?

Kim Holburn kim.holburn at anu.edu.au
Tue Aug 19 23:09:45 EST 2003


At 10:13 PM +1000 2003/08/19, Paul Warren wrote:
>I've got a whole bunch of .wav files with spaces in them.  Now it seems
>that linux command line tools don' like spaces.   My usual script to
>encode as ogg's doesn't work:
>
>for I in *.wav
>do
>oggenc -q6 $I
>done

ls -1 *.wav|while read I; do
  oggenc -q6 "$I"
done


>
>neither does
>for I in `ls -1`
>do
>oggenc -q6 $I
>done
>
>If i do a
>
>for I in `ls -1`
>do
>echo $I
>done
>
>I get something like the following
>
>01
>pure
>morning.wav
>02
>brick
>shithouse.wav
>03
>you
>don_t
>care
>about
>us.wav
>04
>
>I also tried
>
>find . -name *.wav | xargs oggenc -q 6

find . -name '*.wav' -printf "\"%f\" "|xargs oggenc -q 6
or
find . -name '*.wav' -printf "\"%h/%f\" "|xargs oggenc -q 6


>
>Same problem.
>
>My question is, How do I turn the spaces to underscores, or

there's a bash ## thingy you can do

ls -1 'fred '*|while read i; do mv "$i" ${i// /_}; done

>alternatively, make a script that can work with spaces in filenames!
>
>Cheers
>
>--
>Paul Warren
>u3292467 at anu dot edu dot au
>www.geocities.com/qvack_82/


-- 
--
Kim Holburn 
Network Consultant - Telecommunications Engineering
Research School of Information Sciences and Engineering
Australian National University - Ph: +61 2 61258620 M: +61 0417820641
Email: kim.holburn at anu.edu.au  - PGP Public Key on request

Life is complex - It has real and imaginary parts.
     Andrea Leistra (rec.arts.sf.written.Robert-jordan)



More information about the linux mailing list