Skip to content

Instantly share code, notes, and snippets.

@victorkristof
Last active March 29, 2016 20:58
Show Gist options
  • Save victorkristof/14271e7f71b64e177f2ee33910591d07 to your computer and use it in GitHub Desktop.
Save victorkristof/14271e7f71b64e177f2ee33910591d07 to your computer and use it in GitHub Desktop.
Rename all files in a directory with sequential numbers
find . -name '*.jpg' | # find jpegs
awk 'BEGIN{ a=1 }{ printf "mv \"%s\" %02d.jpg\n", $0, a++ }' | # build mv command
bash # run that command
# Source: http://stackoverflow.com/a/10780250/2086547
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment