ic computer scan and optimizer program is available free of charge.' name='description'/> Ethical Hacking:Ethical hacking tutorials: Converting all files in a directory to lowercase.(#21)
Mobile ads

Google Search engine

Converting all files in a directory to lowercase.(#21)

Posted by Unknown | Posted in , | Posted on 10:08 AM

Converting all files in a directory to lowercase.(#21)
#!/bin/sh
# lowerit
# 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`
do
if [ ! -f $x ]; then
continue
fi
lc=`echo $x | tr '[A-Z]' '[a-z]'`
if [ $lc != $x ]; then
mv -i $x $lc
fi
done

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]'`;
done;

on the command line.

Comments (0)

Post a Comment