Command Line Tip: Lowercase all file names in a given directory

Here’s a one-liner you can use to change all the filenames that include uppercase letters to lowercase. If I didn’t write about it, I’d forget how it works, so here we go!
for f in *;
mv $f $(echo $f | tr '[:upper:]' '[:lower:']);
done;Break down:
for file in *:
For every file (variable). You could also do in *.pdf and that would only select PDF’s for example
do echo $f:
do is part of the for loop syntax, echo the variable f
mv $f $(echo $f | tr '[:upper:]' '[:lower:']):
- Run
translate characters (tr)command to translate upper case characters to lower case characters - Then move the original file name to the one outputted by the
trcommand - You’re done! Celebrate
