Skip to main content
Participating Frequently
January 16, 2020
Question

Batch Rename Multiple Images Using Different File Names

  • January 16, 2020
  • 5 replies
  • 3974 views

Hi, 

 

I'm aware of using Bridge to batch rename Images but this relies on all images having the same image name but different sequence. e.g garden-1.jpeg Does anyone know how to batch rename a group of images but use individual filenames? e.g.

file 1 = 10682s-1.jpeg

file 2= 19336g-1.jpeg

file 3 =  4324r-1.jpeg

 

Thanks

This topic has been closed for replies.

5 replies

Stephen Marsh
Community Expert
Community Expert
January 16, 2020

The following workflow uses ExifTool as that is what I am familiar with. It may not be this easy for you, as I am working with a simplified model where all files are in a single folder called "rename" on the desktop, but it is a start point for your testing (work on copies of the original files).

 

Step 1: Backup the original/old filename to the XMP:PreservedFilename tag as detailed in the links in my earlier post.

 

Step 2: Save out a .csv file from your PLM system, containing the product code and current/old filename. The following .csv example only uses 2 images, however it could be 20,000 images:

 

Code,Filename
0001,test1.psd
0002,test2.psd

 

Step 3: Create a copy of the exported .csv and then edit it in a spreadsheet app to change the column headers over to what ExifTool requires and to also update the full Mac OS image path. In this example, I will be writing the product code to an unused metadata field, the IPTC Extension Suppliers Image ID. I have named this plain text file "import.csv" and it looks like this:

 

XMP-plus:ImageSupplierImageID,SourceFile
0001,/Users/username/Desktop/rename/test1.psd
0002,/Users/username/Desktop/rename/test2.psd

 

Step 4: Use the following ExifTool command to import the product code (by default the original file is renamed with _original for safety, however, an additional CLI argument can be added to overwrite the original files once you are happy that all is working as intended):

 

 

exiftool -sep "," -csv='/Users/username/Desktop/rename/import.csv' '/Users/username/Desktop/rename/'

 

 

Step 5: Finally you can use the following ExifTool command to rename only PSD images:

 

 

exiftool '-FileName<${XMP-plus:ImageSupplierImageID}.%e' -r -ext psd '/Users/stephenmarsh 1/Desktop/rename'

 

 

Note: These commands are formatted for the Mac OS, for Windows swap the straight single quotes for straight double quotes and use appropriate file path formatting. Work on copies of the original files until you are happy with the results.

 

You can then tidy up by clearing out the temp. metadata in the supplier image ID field (or whatever metadata field was used as a placeholder) and or update the preserved filename metadata with the new filename.

Stephen Marsh
Community Expert
Community Expert
January 16, 2020

If I was doing this, my first step would be to preserve the current filename in metadata, and ensure that it was actually preserved. I would either do this via Adobe Bridge or ExifTool:

 

https://community.adobe.com/t5/bridge/batch-rename-preserving-original-filename-and-modified-date/m-p/9985629

https://community.adobe.com/t5/bridge/bridge-does-not-preserve-original-file-when-patch-renaming/m-p/9177684

 

Next would be to rename using an appropriate tool that can use a text file from your PLM system.

 

Depending on the software, you may first need to put the product code into a metadata field, then rename using the metadata field. Both of these options are possible with ExifTool.

 

Time permitting I can show some examples to help, as CLI tools can be hard for many users used to driving a computer via a GUI.

 

P.S. There are a few options for exporting and importing metadata listed here at my blog post:

 

https://prepression.blogspot.com/2016/08/extracting-metadata-to-csv.html

 

Adobe Bridge can Batch rename from a limited set of metadata fields so you could possibly do all of this using existing scripts without any further development or using ExifTool.

 

Stephen Marsh
Community Expert
Community Expert
January 16, 2020

Does the product file system contain the old filename as well as the matching product code? 

Participating Frequently
January 16, 2020

Yes, it does.

Stephen Marsh
Community Expert
Community Expert
January 16, 2020

Then you are in luck. My expectation is that you can export out of your PLM/DAM a .CSV or other text file containing the old filename (with or without full image path) and the required new product number to use as the filename. As c_pfaffenbichler suggested, it should just be a case of leveraging an existing 3rd party program or a script to batch change the filenames.

Participating Frequently
January 16, 2020

You'll have to be more specific.

How do you want to rename the files?

And what are the files going to be renamed to?

c.pfaffenbichler
Community Expert
Community Expert
January 16, 2020

Sorry, I am unclear on what the current names are and what they should be? 

Participating Frequently
January 16, 2020

Sorry should have I clarified. 

 

Currently, I have multiple files e.g

 

La Ponderso Malbec

La Ponderso Chardonnay

And I need them to be changed to their product code name then sequence and file name. e.g. 

La Ponderso Malbec change to 10682s-1.jpeg

La Ponderso Chardonnay change to 19336g-1.jpeg

 

And I was wondering if there is a way to do this in batch rename. 

 

Thanks

Legend
January 16, 2020

Where did you get the product code? Bridge has no way to know that information.

You could write a script to pull from a file, I suppose, but that might take as long as doing it manually.