Creating Script that renames photographs

MMiller1559

Registered
Hi all!

I am looking to create a script that will enable me to rename hundreds of photos to correspond to my works product SKU's. Essential we have the photos, but need to figure out how to rename them in an efficient manner.

Is there any way if I have an excel file with the names of both the image names as they are now in one column and the names the we need them changes to in another that I can write a script that will pull the name we need and apply it the photo it should correspond to?

Any help at all would be greatly appreciated!
 
As a quick draft, I have this:
Code:
tell application "Finder"
	set the_folder to container (POSIX file "/path/to/folder/with/pictures")
	set x to the clipboard as text
	
	set AppleScript's text item delimiters to "\r"
	set x to every text item of x
	set AppleScript's text item delimiters to "	"
	repeat with f in x
		set the name of file (text item 1 of f) of the_folder to (text item 2 of f)
	end repeat
end tell

It has no Excel integration. What it does is take tab-delimited lines from the clipboard, one line per file, and change the names accordingly. I think you could simply select and copy the fields in Excel and then run this script, but I haven't tested that (I don't have Excel).

Excel may or may not have scripting capabilities that can make this more elegant, but this script could serve as a quick-and-dirty solution.
 
Last edited:
Back
Top