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:

  • Does a 4–0 Win Tell Us More Than a 1–0 Win?
  • How long until a double hat-trick in the Premier League?
  • Space Weather - The Musical
  • Who wins in a 48 team World Cup - Panini
  • When Good Ideas Don't Survive Contact With Data - A December Football Myth Tested