Skip to content

Instantly share code, notes, and snippets.

@benwells
Created April 7, 2014 15:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benwells/10022347 to your computer and use it in GitHub Desktop.
Save benwells/10022347 to your computer and use it in GitHub Desktop.
Batch renaming files in a directory using bash
# Batch renaming/mv/cp/etc... using bash
# Step 1: to make a backup copy of all pdf files in a directory
for i in *.pdf ; do mv "$i" "${i}.backup" ; done
# Step 2: to copy one file over all of the original files in this directory
for i in *.pdf ; do cp "~/source.pdf" "${i}" ; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment