Last active
August 29, 2015 14:21
-
-
Save magnetikonline/189b514e0ef8b414856f to your computer and use it in GitHub Desktop.
Bash script to rename collection of JPG images with numeric index, ordered by date created.
This file contains hidden or 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 | |
IFS=$'\n' | |
counter=1 | |
for file in $(ls -1tr *.jpg); do | |
mv "$file" "$(printf "img_%04d.jpg" "$counter")" | |
counter=$(($counter + 1)) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment