Nope. Reason: the way the variable is assigned at the very beginning loses the filename way before it even has a chance to make mv choke. Basically, with the script as shown, the file "Some File" will pass thru the script twice, once as "Some", and once as "File", and the error message mv will return will be the following: mv: ./Some: No such file or directory mv: File: No such file or directory :-) --Try: #!/bin/bash FILES=`find -type f | sed s/" "/"-SpAcE-"/g`; for FILE in $FILES; do LOWER=`echo "$FILE" | sed s/"-SpAcE-"/" "/g | tr 'A-Z ' a-z_ `; UPPER=`echo "$FILE" | sed s/"-SpAcE-"/" "/g`; if (test "$UPPER" != "$LOWER") then mv "$UPPER" "$LOWER" echo "$UPPER -> $LOWER" fi done -- George Toft wrote: > > You'll have to enclose $FILE in quotes in the mv command, > otherwise you'll get something like this:\ > FILE <- Some File > LOWER <- some_file > mv Some File some_file (which will blow up) > Try: > mv "$FILE" $LOWER > Kurt Granroth wrote: > > > meg@cs.csoft.net wrote: > > > >> Certainly someone must have a script (preferably Perl) > >> laying around somewhere that will: > >> > >> Recurse thru directories and rename files by replacing > >> any UPPER case characters with lower and replacing spaces > >> in the file names with something like underscores. > > > > > > Off the top of my head, this might work: > > > > #!/bin/sh > > FILES=`find -type f`; > > for FILE in $FILES; > > do > > LOWER=`echo $FILE | tr 'A-Z ' a-z_`; > > mv $FILE $LOWER; > > done > > > > Not tested and won't work if your directories have upper case letters > > or spaces. -- jkenner @ mindspring . com__ I Support Linux: _> _ _ |_ _ _ _| Working Together To <__(_||_)| )| `(_|(_)(_| To Build A Better Future. |