Skip to content

Instantly share code, notes, and snippets.

@benvium
Created March 8, 2013 13:56
Show Gist options
  • Select an option

  • Save benvium/5116590 to your computer and use it in GitHub Desktop.

Select an option

Save benvium/5116590 to your computer and use it in GitHub Desktop.
Rename all PNG files in the current directory to have numbers e.g. 0001.png 0002.png.
#!/bin/sh
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