Convert Filenames to Lowercase on Linux

If you transfer files from a Windows server to a Linux one, you may get some broken links because Linux is case-sensative while Windows isn’t. You can rename all the files on the Linux server to their lowercase equivalents with this shell script from Linux Journal.

# 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`
	if [ ! -f $x ]; then
	lc=`echo $x  | tr '[A-Z]' '[a-z]'`
	if [ $lc != $x ]; then
		mv -i $x $lc

Leave a Reply

Your email address will not be published. Required fields are marked *