Created
July 17, 2015 03:34
-
-
Save lee2sman/ec30cf3032d1c3554181 to your computer and use it in GitHub Desktop.
rename all files in a folder sequentially
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# batch rename all items in a folder regardless of title into sequential number order | |
# warning: will throw an error if you have any | |
i=1 | |
for f in *.jpg # remove .jpg if you want to force rename all files but be careful. Also: will throw error with directories | |
do mv "$f" "$( printf "%02d.jpg" $i )" # the 02d means generate file numbers 00-99. use 3d for 000-999. | |
((i++)) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment