Skip to content

Instantly share code, notes, and snippets.

@newsroomdev
Last active August 29, 2015 14:02
Show Gist options
  • Save newsroomdev/2e2d8eabf4a5fb7e4e3b to your computer and use it in GitHub Desktop.
Save newsroomdev/2e2d8eabf4a5fb7e4e3b to your computer and use it in GitHub Desktop.
ReBasename
# ReBasename
# A simple script to iteratively create a new basename for files based on their extensions
#
# rebasename [file ext] [basename]
#
# Todo:
# increment argument
function rebasename() {
n=0;
for file in *."$1" ; do mv "${file}" "$2""${n}"."$1"; n=$((n+1)); done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment