Copy link to clipboard
Copied
I would like to keep the original filename created by camera as a keyword within an image so that even if I rename a image the original filename is available and I can locate it from a backup copy. I would like to create a script to automate this process. Any ideas would be welcomed.
Copy link to clipboard
Copied
See this thread...
Copy link to clipboard
Copied
There is another option using Adobe Bridge, which does not require any scripting.
Some may argue that keywords should be kept strictly for that purpose. For those that don’t wish to put the filename in keywords, there is a specific metadata entry <xmpMM:PreservedFileName> that is used to store the original filename, which is then used to restore that filename if required at a later date.
Adobe Bridge Batch Rename (Preserve Original Filename):
Adobe Bridge Batch Rename (Restore Original Filename):
This method is of course independent of using a keyword, however if you do need to restore the original filename at a future point, it is very easy to do so without requiring yet another script to perform the task.
----------
Of course, one can also preserve and restore the original filename using ExifTool:
Add/Copy filename to Adobe Preserve Original Filename (sans file extension) metadata entry, overwriting original:
exiftool -overwrite_original_in_place '-XMP-xmpMM:PreservedFileName<${filename;s/\.[^.]*$//}' -r '/Mac OS/Path/to/File or Folder'
----------
Add/Copy filename to Adobe Preserve Original Filename (including file extension) metadata entry, overwriting original:
exiftool -overwrite_original_in_place '-XMP-xmpMM:PreservedFileName<${filename}' -r '/Mac OS/Path/to/File or Folder'
----------
Rename files using their preserved filename metadata entry:
exiftool '-FileName<XMP-xmpMM:PreservedFileName' -r '/Mac OS/Path/to/File or Folder'
----------
These ExifTool command line code examples are formatted for the Mac OS. MS Windows users would use straight double quote marks " rather than straight ' single quote marks and the expected \ file path formatting.
Copy link to clipboard
Copied
Although I can’t write scripts, I can sometimes hack them…
Here is a Bridge script to add the current filename to the xmpMM:PreservedFileName metadata entry:
// https://forums.adobe.com/thread/656144
// https://forums.adobe.com/message/9498691
#target bridge
addNametoMeta = {};
addNametoMeta.execute = function(){
var sels = app.document.selections;
for (var i = 0; i < sels.length; i++){
var md = sels.synchronousMetadata;
md.namespace = "http://ns.adobe.com/xap/1.0/mm/";
var Name = decodeURI(sels.name).replace(/\.[^\.]+$/, '');
md.PreservedFileName = md.PreservedFileName + Name;
}
}
if (BridgeTalk.appName == "bridge"){
var menu = MenuElement.create( "command", "Save Filename in PreservedFileName metadata", "at the end of Tools");
menu.onSelect = addNametoMeta.execute;
}
Adobe Bridge (or ExifTool) could then be used to restore the filename as shown in my previous post.
P.S. I forgot to mention, you can view this xmpMM:PreservedFileName metadata in Adobe apps via the File menu > File Info > Raw Data tab, or using the following ExifTool command:
exiftool -XMP-xmpMM:PreservedFileName -r FILE-OR-DIRECTORY-PATH-HERE