Bridge Batch Rename Using Any XMP Data

  • 4
  • Idea
  • Updated 3 months ago
Bridge only has a limited set of XMP options that can be used with the Batch Rename option.

It would be good to have a “wildcard” option to use any XMP field if it was available/populated in the files.

This would be similar to the “From Other XMP” option found in InDesign’s Object Export Options for Alt Text.

A mockup image below:

 

The property value would be used as described here:

http://prepression.blogspot.com.au/2016/02/indesign-alt-text-from-image-xmp-metadata.html
Photo of Stephen Marsh

Stephen Marsh

  • 74 Posts
  • 15 Reply Likes

Posted 3 years ago

  • 4
Photo of Jeff Sydor

Jeff Sydor

  • 2 Posts
  • 0 Reply Likes
There should be some other options such as "Source" or something. Just access to the other Meta Info options would be helpful. 

I'm trying to update the file names to the library of Adobe Stock images that we've accrued (which is a lot!) and I can automate everything but the unique ID of the image. Which is located in "Source".
Photo of Stephen Marsh

Stephen Marsh

  • 74 Posts
  • 15 Reply Likes
Hi Jeff, I’m curious...

Can you provide a sample image with this metadata so that I can give it a look (it could be resized to a small thumb or a 1 pixel crop, it is all about the metadata, not the pixels)?

How about a screenshot of your batch rename settings, or a few before/after renaming examples?

Photo of Jeff Sydor

Jeff Sydor

  • 2 Posts
  • 0 Reply Likes
This is what I was talking about.
Photo of Stephen Marsh

Stephen Marsh

  • 74 Posts
  • 15 Reply Likes
Ah, I see... I can think of a few options (time permitting I’ll experiment):

  • OS level script to rename (you are only Mac based?)
  • ExifTool to rename (cross platform)
  • Bridge script to rename (cross platform)
  • Two step workflow. Bridge script to copy the source metadata field to another field that is available to Batch Rename, presuming that there is one left free that you are not using. Then you would run the batch rename (cross platform)








Photo of Stephen Marsh

Stephen Marsh

  • 74 Posts
  • 15 Reply Likes
This is the sort of flexibility that I am requesting in Bridge with my original post “any metadata wildcard” batch rename option.

Here is an ExifTool command line option (formatted for Mac, Windows users would change the straight single quotes to straight double quotes). Note that these commands don’t attempt to clean up illegal filename characters, so work on copies until you know that it is working correctly for your data. The original filename is not preserved in metadata. No backup of the original file is created, it is simply renamed. Characters that are illegal for Windows filenames are removed. Use at your own risk:

exiftool '-filename<${title;}_AdobeStock_${source;}.%e' -r 'path to top level folder or file'

Building upon this “basic” example, we can also store the original filename in metadata, just as we do in Bridge’s Batch Rename tool (this command preserves the modified date/time and overwrites the original file). All special and potentially illegal characters are removed using a regular expression in order to simplify the filename (I am not sure if this is bullet proof). Use at your own risk:

exiftool -P -overwrite_original '-XMP-xmpMM:PreservedFileName<${filename}' '-filename<${title;s/\W+//g}_AdobeStock_${source;s/\W+//g}.%e' -r 'path to top level folder or file'
____________


EDIT: I can’t write scripts, however I can sometimes hack them... The following code works fine on a single file, however it is failing to rename multiple files where only a single file is renamed. I am hoping that somebody that actually knows what they are doing can correct my code hack! Use at your own risk:

// https://www.ps-scripts.com/viewtopic.php?f=72&t=14282&p=89792&hilit=rename#p89787
#target bridge 
if( BridgeTalk.appName == "bridge" ) { 
MetaStringRenamer = new MenuElement(“command", "Rename to Title+_AdobeStock_+Source.ext", "at the end of tools");
}
MetaStringRenamer.onSelect = function () { 
var sels = app.document.selections;
for(var z=0; z < sels.length; z++) {
var thumb = sels[z];
var selectedFile = thumb.spec;
md = new Thumbnail(selectedFile).synchronousMetadata; 
md.namespace = "http://purl.org/dc/elements/1.1/"
Title = md.title;
Title = Title.toString().replace(/[:\/\\*\?\"\<\>\|]/g, "_");
md.namespace = "http://ns.adobe.com/photoshop/1.0/"
Source = md.Source;
Source = Source.toString().replace(/[:\/\\*\?\"\<\>\|]/g, "_");
}
var ext = thumb.name.match(/\..+$/);
File(selectedFile).rename((Title+"_AdobeStock_"+Source+ext));
}
function zeroPad(n, s) { 
   n = n.toString(); 
   while (n.length < s)  n = '0' + n; 
   return n; 
};

http://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html
(Edited)