How To Convert Filenames To Lowercase On Unix

To make the conversion character we will use the tr (translate characters) Unix command.

Create a file with some characters uppercase;

touch MyLittleFile.LOG

Run the following command. It is a mv in which we say rename the old and new files with all lowercase characters;

mv MyLittleFile.LOG `echo MyLittleFile.LOG | tr [:upper:] [:lower:]`

And we get the following result;

mylittlefile.log

With this command we can also proceed backwards, go to uppercase. Run the following commands;

mv mylittlefile.log `echo mylittlefile.log | tr [:lower:] [:upper:]`

And get change the file name as stated below;

MYLITTLEFILE.LOG

HTH – Antonio NAVARRO

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s