Change case of all filenames

After using KERMIT to transfer some old source files from my DEC Rainbow to my PC I found that all the files were saved on my PC with lower case filenames.

Once I got over my amazement that my DEC Rainbow still worked despite being almost 30 years old, I found that in order to be able to read these files on an emulated CP/M system using SIMH I needed to change all the filenames to use only upper case letters.

rainbow_graphics
To do this I used the following ‘one liner’ to change the case of the name of all the files in a folder (and sub-folders) to upper case.

# find . -type f -exec rename 's/(.*)\/([^\/]*)/$1\/\U$2/' {} \;

If you need to change all the filenames to lower case letters instead just use an ‘L’ instead of a ‘U’ in the rename command.

# find . -type f -exec rename 's/(.*)\/([^\/]*)/$1\/\L$2/' {} \;

This entry was posted in Linux and tagged . Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment:

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