Skip to content

Instantly share code, notes, and snippets.

@Jamiewarb
Created January 12, 2019 14:15
Show Gist options
  • Save Jamiewarb/c0a42af70b19d1a5a0699fa57da202c8 to your computer and use it in GitHub Desktop.
Save Jamiewarb/c0a42af70b19d1a5a0699fa57da202c8 to your computer and use it in GitHub Desktop.
Rename all files in a directory with a sequential numerical prefix/suffix
#ls | cat -n | while read n f; do mv -n "$f" "FILENAME-$n.extension"; done
#e.g.
ls | cat -n | while read n f; do mv -n "$f" "rheinbacher-premium-beissbier-$n.jpg"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment