Making Files and Folders Lowercase

Very occasionally I want to make all the files and folders of a particular directory lowercase (usually when porting an existing directory structure from Windows to Linux) this is how I do it.

You could set up some form of recursive renaming script in a similar fashion to my post on Batch Process in Bash. But it is much nicer to do it in just the one line, assume we want to change all the file and folder names inside the folder ‘/home/sean/windows/’:

find /home/sean/windows/ -depth -exec rename 's/(.*)\/([^\/]*)/$1\/\L$2/' {} \;

Job done!




Enjoy Reading This Article?

Here are some more articles you might like to read next:

  • Batch Process in Bash
  • Was there room on the door for two?
  • Quick way to remove X Server for running a headless server
  • Does a 4–0 Win Tell Us More Than a 1–0 Win?
  • Space Weather - The Musical