[clug] Spaces in filenames?

Eyal Lebedinsky eyal at eyal.emu.id.au
Tue Aug 19 22:58:52 EST 2003


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
[snip]
> My question is, How do I turn the spaces to underscores, or
> alternatively, make a script that can work with spaces in filenames!

Spaces in filenames is an abomination. Nevertheless, this will work

for I in *.wav ; do
	oggencoggenc -q6 "$I"
done

but NOT is "oggenc" is a script that fails to quote. You can rename
though:

for I in *.wav ; do
	new=`echo $I | tr " " "_"`
	mv "$I" "$new"
done

--
Eyal Lebedinsky (eyal at eyal.emu.id.au) <http://samba.org/eyal/>



More information about the linux mailing list