Skip to content

Instantly share code, notes, and snippets.

@kevonc
Created March 2, 2014 02:52
Show Gist options
  • Save kevonc/9301174 to your computer and use it in GitHub Desktop.
Save kevonc/9301174 to your computer and use it in GitHub Desktop.
One-line batch file rename
To Change [1] to .jpg in all your files
First, lets display the output to make sure it is correct
ls * | awk '{print("mv "$1" "$1)}' | sed 's/\[1\]/.jpg/2'
If it looks right, pipe the output to shell to execute
ls * | awk '{print("mv "$1" "$1)}' | sed 's/\[1\]/.jpg/2' | /bin/sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment