Skip to content

Instantly share code, notes, and snippets.

@mattlockyer
Created April 30, 2020 23:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattlockyer/1343154e9c12c3bd8317483024333e99 to your computer and use it in GitHub Desktop.
Save mattlockyer/1343154e9c12c3bd8317483024333e99 to your computer and use it in GitHub Desktop.
Rename all files of a type in a folder with a sequential number scheme
a=1
for i in *.jpg; do
new=$(printf "%04d.jpg" "$a") #04 pad to length of 4
mv -i -- "$i" "$new"
let a=a+1
done
# from https://stackoverflow.com/a/3211670/1060487
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment