Skip to content

Instantly share code, notes, and snippets.

@soltrinox
Created April 2, 2015 19:57
Show Gist options
  • Select an option

  • Save soltrinox/70f36acdb59bdd3864c6 to your computer and use it in GitHub Desktop.

Select an option

Save soltrinox/70f36acdb59bdd3864c6 to your computer and use it in GitHub Desktop.
rename files in BASH shell to sequence
#!/bin/bash
a=1
for i in *.png; do
new=$(printf "%04d.png" "$a") #04 pad to length of 4
mv -- "$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