Mac: Rename all files names in a directory to lower case

Just like my last post, I was working with a directory of about 1000 files. There were all sorts of problems with the way they were named. Anyone who is used a *nix type system will know that “.jpg”, “.Jpg”, “.JPG” are all very separate things. To solve the issue I was having I needed to rename all of the files in the directory to lowercase.

I fired up my friend the Mac terminal and ran the following command:

for i in *; do mv "$i" "$(echo $i|tr A-Z a-z)"; done

The code loops through each of the files in the current directory and renames it to the lowercase equivalent. fast, simple, elegant. Major time saver.


  1. Very useful, thanks! Although is there a way of allowing it to work recursively, renaming files inside all folders inside the original directory?

    Thanks again!

  2. What happens when there are other files with the same name only lowercase in the same folder? Also how do you apply this to s specific drive? In my case I have an external drive that has all my iTunes (almost 500 GB of music). I would like to transfer the entire folder to a drive that is formatted not case sensitive and of course it cannot because there’s a lot of files that have caps. Ideally I would eventually be rid of all duplicates but that’s not happening today. I have the impression using the NON-case sensitive formatting is better. I just switched from windows and haven’t had a Mac since OS 8.6 before iTunes existed.

  3. I found this:
    for f in *; do mv “$f” “`echo $f | tr “[:upper:]” “[:lower:]”`”; done

    Looks like the same thing 😀

  4. Since OSX is case-insensitive you have to do a little dance through a tmp file. Something like this will work:

    `for old_name in *; do new_name=”$(echo $old_name | tr A-Z a-z)”; mv “$old_name” “${new_name}._tmp_”; mv “${new_name}._tmp_” “$new_name” ; done

Leave a Comment.