Saturday, July 14, 2012

Batch rename files from lower case file name to upper case filename or vice versa!

Suppose you have a lot of image files in lower case name and you want to change rename them to upper case filename or vice-versa


for file in *.jpg; do mv $file $(echo $file | tr a-z A-Z); done

or from upper case to lower case

for file in *.JPG; do mv $file $(echo $file | tr A-Z a-z); done

If filenames contains spaces in them then just wrap the variable names in "", like

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

No comments:

Post a Comment