-
All replies
-
Helpful answers
-
Jun 30, 2014 6:54 AM in response to doalaby Tony T1,This will work with a comma separated text file,
i.e.:
Files as the are, Files Renamed
01.mkv, Valar Dohaeris.mkv
02.mkv, Mhysa.mkv
Note that if the file to be renamed exists, it will be overwritten (A test can be added to skip if exists if needed)
set theFoler to POSIX path of (choose folder with prompt "Choose folder with Files" default location path to desktop)
set theFile to POSIX path of (choose file with prompt "Choose TXT file" default location path to desktop)
do shell script "
cd " & quoted form of theFoler & "
while read line
do
OldImageName=${line%,*}
NewImageName=${line#*,}
if [ -e \"$OldImageName\" ] ; then
mv \"$OldImageName\" \"$NewImageName\"
else
echo \"$OldImageName\" >> ~/Desktop/Errors.txt
fi
done < " & quoted form of theFile & "
"