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?
  • The Impact of Form in Fantasy Football
  • Rooney Scores 50 goals for England – the data
  • God's Number is 20