[ale] quick way to rename all files ?

Wandered Inn esoteric at denali.atlnet.com
Mon Aug 27 06:05:22 EDT 2001


Gary MacKay wrote:
> 
> Is there a quick way to rename all files in a directory to lower case?
> Same filename, just rip through and make sure they are all lowercase.

for fn in *;do
	if [ -f $fn ]; then mv $fn $(echo $fn|tr '[A-Z]' '[a-z]'); fi
done

You might want to make sure a file with the new name doesn't already
exit though:

for fn in FOO;do
	nfn=$(echo $fn|tr '[A-Z]' '[a-z]')
	if [ ! -f $nfn ] && [ -f $fn ]; then mv $fn $nfn; fi
done

> 
> - Gary
> --
> To unsubscribe: mail majordomo at ale.org with "unsubscribe ale" in message body.

--
Until later: Geoffrey		esoteric at denali.atlnet.com

"I don't want a Microsoft Passport, and Microsoft can't have my wallet."
--
To unsubscribe: mail majordomo at ale.org with "unsubscribe ale" in message body.





More information about the Ale mailing list