Skip to content

Instantly share code, notes, and snippets.

@rcanepa
Created April 8, 2016 20:43
Show Gist options
  • Save rcanepa/374e9aba820117bce29b510b271ca76d to your computer and use it in GitHub Desktop.
Save rcanepa/374e9aba820117bce29b510b271ca76d to your computer and use it in GitHub Desktop.
Add prefix to multiple files at once
# Add office- prefix to all files on a directory
ls | xargs -I {} mv {} office-{}
# Add office- prefix to all .js files on a directory
ls | grep .js | xargs -I {} mv {} office-{}
More information:
http://stackoverflow.com/questions/6329505/how-to-rename-all-file-in-a-folder-with-a-prefix-in-a-single-unix-command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment