[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
> 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"

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

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

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

More information about the linux mailing list