Skip to content

Instantly share code, notes, and snippets.

@nightcrawler-
Created March 31, 2020 07:56
Show Gist options
  • Save nightcrawler-/1678348d47ec521aaf03aa6e8e4d3586 to your computer and use it in GitHub Desktop.
Save nightcrawler-/1678348d47ec521aaf03aa6e8e4d3586 to your computer and use it in GitHub Desktop.
Rename all PNG files in directory sequentially from 1, pad to x length
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