Skip to content

Instantly share code, notes, and snippets.

@guillaumewuip
Created May 30, 2016 05:33
Show Gist options
  • Save guillaumewuip/78eca8a9d02f21f183039ef484c83f5b to your computer and use it in GitHub Desktop.
Save guillaumewuip/78eca8a9d02f21f183039ef484c83f5b to your computer and use it in GitHub Desktop.
Rename pictures in directory with 001.JPG, 002.JPG ... if they were named 1.JPG 2.JPG, ...
FILES=./*.JPG
for f in $FILES
do
filename=`basename $f`;
filename="${f%.*}"
filename="${filename#./}"
newFilename=`printf "%03s\n" $filename`;
echo $newFilename.jpeg;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment