r/applescript • u/conflob • Mar 21 '23
Renaming files in bulk using Apple Script
I currently use windows and have a piece of Command prompt script that will rename all files in a folder, the template of the command prompt is this: ren "example.jpg" "example-1.jpg"
This would change the jpg called example to 'example-1'. I copy this formula in Excel with a list of the file names, when the column of these scripts is copied into the command prompt within the desired folder, it will rename all the files.
I'm struggling to find an equivalent process on mac using AppleScript. Can anyone help?
For context, I will be working from an excel sheet with the old file names in one column, and the new names in another column, so if I can get a set piece of code like the above, I can concat all the relevant names in excel for each file.
Thanks
View all comments
Show parent comment
1
u/copperdomebodha Mar 22 '23
I'm not sure what you mean by "opened within a file". But if you're trying to simplify the renaming of files listed in an open Excel doc, it could be coded many ways. I would think dropping the folder containing the original-named files on a script application, having that trigger the lookup of the rename data in the frontmost Excel doc would be a good way to go. Bu the data could just be a CSV or TSV text file and you could drag both a folder and the data file on a script app. Like I said, many options.