Created
March 20, 2020 10:00
-
-
Save jorgeas80/f6167426f86cedfe96b5c98a90cdeeab to your computer and use it in GitHub Desktop.
Batch rename files in a dir to a sequential name by file date
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 | |
a=1 | |
for i in *.png; do | |
new=$(printf "%04d.png" "$a") #04 pad to length of 4 | |
mv -i -- "$i" "$new" | |
let a=a+1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Taken from https://stackoverflow.com/a/3211670/593722