Productive Linux


 Subscribe via Feedburner in a reader

Enter your email address:

Delivered by FeedBurner


Don't have an account?
Sign up to
Forgot your password?

Converting filenames to lowercase
27 July 2004 @ 13:19 BST
by Paul

The easiest way to convert all the files to lowercase is to use rename. Like this:

rename 'y/A-Z/a-z/' *

Here is a shell script to convert all files in the working directory to lowercase:

for filename in *
   n=`echo $filename | tr '[:upper:]' '[:lower:]'`
   mv $filename $n

Here is a perl one-line that does the same thing from the command line:

perl -MFile::Copy -e 'move $_, lc($_) foreach glob "*"'

And a perl script that does the same thing:


use warnings;
use strict;
use File::Copy;

move $_, lc($_) foreach glob '*';

The last perl script is dangerous, as it overwrites files when they acquire the same name due to the conversion.

Posted by Guest User on 2006-04-22 15:31:30.

convmv can do that job, too - even if files contain umlauts in arbitrary charsets.

Posted by bj on 2011-08-11 00:44:02.
Comments disabled