"Eugene L. Vorokov" wrote:
>
> I have a script which is supposed to convert all filenames to lowercase
> recursively from current directory. It looks like:
>
> echo "Processing files"
> for i in `ls |grep [A-Z]`; \
> do mv $i `echo $i |tr [A-Z] [a-z]`; echo $i;\
> done;
> for i in `find . -name "*" -type d -maxdepth 1`;\
> do if [ $i != "." ]; then cd $i; echo "Processing sub-dir $i"; $0; cd ..; fi \
> done;
>
> It works fine unless some file or directory has a space in it's name.
> It this case each word is interpreted as a separate argument by 'for'
> and script doesn't find files.
Any way using `` won't work. for i in a "b c" d works, for instance, but
there is not way that I know of that you can control the output this way
using ``.
OTOH, try:
find . -type d -maxdepth 1 -print -exec mv {} `echo {} | tr [A-Z] [a-z]`
\;
--
Daniel C. Sobral (8-DCS)
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
wow regex humor... I'm a geek
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message