MacOS – is it possible to batch rename from a list, using a bat file like rename filename.txt newfilename.txt

applescriptautomatorfindermacos

So I teach a class and a few of my students have Macs. Literally the only thing I have encountered is this .bat issue.

We use Excel to start with a list of filenames in one column, and a list of new filenames in the other column, and then create a bat file. The new names are not intuitive and they do not follow a pattern, so typical logic can't handle this; we must rely on the list.

Do Macs have something that can work? I would love to provide a solution.

This is what it looks like in windows (this assumes all files are in the same folder, and the bat file runs from the root; it is just as possible to use fullpaths)

rename accounting2016.xls ID0001.xls
rename vacationphoto01.jpg ID0042.jpg
rename BuildingPlans.docx ID0189.docx

Best Answer

If I read the question correctly, you are generating the batch file from some sort of exporting process from the Excel columns containing the command and two file names?

In such a case you can just change the rename command to "Mac equivalent" mv. The file now contains

mv accounting2016.xls ID0001.xls
mv vacationphoto01.jpg ID0042.jpg
mv BuildingPlans.docx ID0189.docx

Then you can run the commands listed in the file with e.g. Bash:

bash renames.txt

Note, that if the file names contain whitespace or other special characters you should surround them with quotes, but I think that is the case also in Windows.