Created
December 28, 2017 21:23
-
-
Save ajatoledo/9439be5aab01b4890060031744497538 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This provides an example of the index template used within the renaming bash gist.