Converting all files in a directory to lowercase.
# convert all file names in the current directory to lower case
# only operates on plain files–does not change the name of directories
# will ask for verification before overwriting an existing file
for x in `ls`
if [ ! -f $x ]; then
lc=`echo $x | tr ‘[A-Z]’ ‘[a-z]’`
if [ $lc != $x ]; then
mv -i $x $lc
Wow. That’s a long script. I wouldn’t write a script to do that; instead, I would use this command:
for i in * ; do [ -f $i ] && mv -i $i `echo $i | tr ‘[A-Z]’ ‘[a-z]’`;
on the command line.
Powered by Facebook Comments