Skip to content

Instantly share code, notes, and snippets.

@ajatoledo
Created December 28, 2017 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajatoledo/9439be5aab01b4890060031744497538 to your computer and use it in GitHub Desktop.
Save ajatoledo/9439be5aab01b4890060031744497538 to your computer and use it in GitHub Desktop.
#!/bin/bash
# this is run within the directory from which the script is executed and relies upon the csv file titled 'index.csv'
# note in the oldname to newname process, bash on mac introduces /r (carriage return) chacters within the csv,
# therefore a step variable is added that overcomes the rename issue
while read line
do
oldName=${line%,*}
step=${line#*,}
newName=${step%$'\r'}
mv "$oldName" "$newName"
done <"index.csv"
@ajatoledo
Copy link
Author

This provides an example of the index template used within the renaming bash gist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment