bulk file rename using csv
Hey guys,
I've been trying to use the automator workflow VikingOSX provided but with no luck. I get a process completed message with no errors, but the file name does not change. I'm using this workflow below, my csv is data.cxv and is UTF-8. not sure what im doing wrong here, any help is appreciated.
cd "$1"
# simply exit if CSV file is absent or empty
[[ -s data.csv ]] || exit 1
# Strip quoted CSV fields (if present) before reading the data
# Dynamically adapt IFS to different CSV delimiters
while IFS=$'\t,;:!' read oldfile newfile
do
# Skip entry if old filename in CSV doesn't exist in current folder
[[ -f "./$oldfile" ]] || continue
# printf '%s\t%s\n' "$oldfile" "$newfile"
# rename
mv $PWD/{"$oldfile","$newfile"}
done < <(sed -e 's/"//g;' < ./data.csv)
/usr/bin/osascript -e 'display dialog "Processing complete."' &> /dev/null
exit 0
MacBook Pro with Touch Bar