Skip to content

Instantly share code, notes, and snippets.

@tce
Created January 19, 2012 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tce/1642135 to your computer and use it in GitHub Desktop.
Save tce/1642135 to your computer and use it in GitHub Desktop.
Rename files in bash
# rename from *.JPG to *.jpg
for x in *.JPG; do mv "$x" "${x/.JPG}".jpg; done
rename 's/\.JPG/\.jpg/' *.JPG
#strip spaces
rename 's/ //' *.JPG
# upper to lower case
rename 'y/A-Z/a-z/' *.JPG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment