Home > recipes > Changing filename case in bash

Changing filename case in bash

I keep having to google for this, so I decided to write it down here. This is how to change the case of every file in a directory to lowercase. It’s a great way to fix the case insensitivity seen when moving files from a windows filesystem to a Unix-y one. We have several windows PC’s in our lab for special machines with windows only requirements.

When in the directory where the files are stored, issue this command from the Bash shell prompt

for i in `ls`; do mv $i `echo $i | tr '[A-Z]' '[a-z]'`; done

Categories: recipes Tags:
  1. No comments yet.
  1. No trackbacks yet.