Last active
July 22, 2016 00:14
-
-
Save bmcbride/a132702fc0c0805db62b to your computer and use it in GitHub Desktop.
Fulcrum PDF reports are named with the record's unique fulcrum_id. This bash script loops through the parent CSV file and renames the PDF files based on the index of user-specified fields.
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 | |
INPUT=fire_hydrants.csv | |
OLDIFS=$IFS | |
IFS=, | |
[ ! -f $INPUT ] && { echo "$INPUT file not found"; exit 99; } | |
while read -a csv_line | |
do | |
mv ${csv_line[0]}.pdf ${csv_line[8]}-${csv_line[0]}.pdf | |
done < $INPUT |
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
FOR /F "usebackq tokens=1,2,26 delims=," %a IN (fire_hydrants.csv) DO ren %a.pdf "%c.pdf" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment