Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

pierre1610

macrumors regular
Original poster
Feb 3, 2009
185
19
I need some help with a automator / script renaming a set of images

Filename = 1234_Tree_House_Shot01_F48_Bee_Hive_COMP_v03b_16x9.jpg

1. Copy the original file name into the ‘title’ field in the metadata of each image before changing the name so the original file name can be later identified

2. Remove the version number, this code works in name mangler “_(([a-z][a-z]\d\d[a-z])|(v\d\d[a-z]))”

Result = 1234_Tree_House_Shot01_F48_Bee_Hive_COMP_16x9.jpg

3. Remove ‘_COMP’ from the filename

Result = 1234_Tree_House_Shot01_F48_Bee_Hive_16x9.jpg

4. Use a spreadsheet to find and replace part the filename, ideally this would be a google sheet page but if not it could be a .csv file

EXAMPLE spreadsheet entries
1234_Tree_House_Shot01_F48_Bee_Hive, GFC23_001_NXT
1234_Tree_House_Shot02_F62_Train_Line, GFC23_002_NXT
1234_Tree_House_Shot03_R_Key_Board, NGT23_003_IXT

The first entry in the spreadsheet has a match so the matched parts of the file name are replaced

Result = GFC23_001_NXT_16x9.jpg

5. Notice that the end of the filename still retains the format identifier (1x1, 16x9, 9x16, Letter) There could also be different words or letter combinations at the end which also need to stay so its important to not have whitelist of words or characters

I have hundreds of images to rename, they are in batches
- 1234_Project_Name_Shot01_Image_Name_Name_COMP_v01a_1x1.jpg
- 1234_Project_Name_Shot01_Image_Name_Name_COMP_v01a_1x1_CMYK.tif
- 1234_Project_Name_Shot01_Image_Name_Name_COMP_v01a_1x1_RGB.tif
- 1234_Project_Name_Shot01_Image_Name_Name_COMP_v01a_16x9.jpg
- 1234_Project_Name_Shot01_Image_Name_Name_COMP_v01a_16x9_CMYK.tif
- 1234_Project_Name_Shot01_Image_Name_Name_COMP_v01a_16x9_RGB.tif
- 1234_Project_Name_Shot01_Image_Name_Name_COMP_v01a_Letter.jpg
- 1234_Project_Name_Shot01_Image_Name_Name_COMP_v01a_Letter_CMYK.tif
- 1234_Project_Name_Shot01_Image_Name_Name_COMP_v01a_Letter_RGB.tif
- 1234_Project_Name_Shot01_Image_Name_Name_COMP_v01a_DD.jpg
- 1234_Project_Name_Shot01_Image_Name_Name_COMP_v01a_DD_CMYK.tif
- 1234_Project_Name_Shot01_Image_Name_Name_COMP_v01a_DD_RGB.tif
- 1234_Project_Name_Shot01_Image_Name_Name_COMP_v01a_DD_Hoof.jpg
- 1234_Project_Name_Shot01_Image_Name_Name_COMP_v01a_DD_Hoof_CMYK.tif
- 1234_Project_Name_Shot01_Image_Name_Name_COMP_v01a_DD_Hoof_RGB.tif
- GFC23_001_NXT_1x1.jpg
- GFC23_001_NXT_1x1_CMYK.tif
- GFC23_001_NXT_1x1_RGB.tif
- GFC23_001_NXT_16x9.jpg
- GFC23_001_NXT_16x9_CMYK.tif
- GFC23_001_NXT_16x9_RGB.tif
- GFC23_001_NXT_Letter.jpg
- GFC23_001_NXT_Letter_CMYK.tif
- GFC23_001_NXT_Letter_RGB.tif
- GFC23_001_NXT_DD.jpg
- GFC23_001_NXT_DD_CMYK.tif
- GFC23_001_NXT_DD_RGB.tif
- GFC23_001_NXT_DD_Hoof.jpg
- GFC23_001_NXT_DD_Hoof_CMYK.tif
- GFC23_001_NXT_DD_Hoof_RGB.tif
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.