Last active
November 6, 2015 20:08
-
-
Save levhita/d5fbddddae1c5a16fad6 to your computer and use it in GitHub Desktop.
Renames all jpgs in a folder sequentially, I use it to make surveillance bulk files compatible with OpenShot import functionality.
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
if [ ! -d "$1" ]; then | |
echo "Directory doesnt exists" | |
exit | |
fi | |
cd $1 | |
a=1 | |
for i in *.jpg; do | |
new=$(printf "%09d.jpg" "$a") #09 pad to length of 9 | |
mv -- "$i" "$new" | |
let a=a+1 | |
done | |
cd .. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment