Skip to main content
dmsduco
Inspiring
Jul 18, 2018 7:54 AM UTC
Answered

Batch rename preserving original filename AND modified date

I’m cleaning up a lot of photos and I want to rename them all using a file naming convention. I want to store the original filename in the metadata so we will be able to find the correct file in case an old filename is referenced.

Bridge has the a checkbox ‘Preserve current filename in XMP Metadata’ for that. Problem is, when this is ticked, Bridge also changes the ‘Modifed date’ of the files. This date is very important in our workflow and should not change.

Any ideas how to store the original filename in metadata AND preserve the modified date of files? Using Bridge or other software (on mac).

This topic is closed to new replies. Start a new post to keep the conversation going.
Stephen Marsh
Stephen MarshCorrect answer
Community Expert
Jul 18, 2018 10:37 AM UTC

I am not sure if it is possible to retain the original modified date with Bridge scripting… However it is possible with ExifTool:

exiftool -P -overwrite_original_in_place '-XMP-xmpMM:PreservedFileName<${filename;s/\.[^.]*$//}' -ext .tif -r '/mac/path/to-file/or top level folder'

Note: This command will overwrite your original files without creating an auto backup, so work on copies until you are sure that the results are correct. The preserved filename will not include the filename extension, however if you do wish to include the extension (as Adobe does) it is simple enough to remove the regex. Preserved filenames can be restored using Bridge or ExifTool with a different command. I have added a file extension filter to only process .TIF files in this example which could be changed or removed as required.

8 replies

Stephen Marsh
Community Expert
Stephen MarshCommunity ExpertCorrect answer
Community Expert
Jul 18, 2018 10:37 AM UTC

I am not sure if it is possible to retain the original modified date with Bridge scripting… However it is possible with ExifTool:

exiftool -P -overwrite_original_in_place '-XMP-xmpMM:PreservedFileName<${filename;s/\.[^.]*$//}' -ext .tif -r '/mac/path/to-file/or top level folder'

Note: This command will overwrite your original files without creating an auto backup, so work on copies until you are sure that the results are correct. The preserved filename will not include the filename extension, however if you do wish to include the extension (as Adobe does) it is simple enough to remove the regex. Preserved filenames can be restored using Bridge or ExifTool with a different command. I have added a file extension filter to only process .TIF files in this example which could be changed or removed as required.

Translate
dmsduco
dmsducoAuthor
Inspiring
Jul 18, 2018 11:32 AM UTC

Thanks, this worked perfectly.

However, a followup question. How to search a file with the old filename?

Neither Finder (Spotlight) nor Bridge show the files when I search for the old filename.

Perhaps there's another meta field I could store the original filename in, which is searchable with Spotlight or Bridge?

Translate
Stephen Marsh
Community Expert
Community Expert
Jul 18, 2018 11:55 AM UTC

You can either use ExifTool, or Bridge’s Find command:

The first search criteria on All Metadata = xmpMM:PreservedFileName (don’t use the <> characters)

The second search criteria on All Metadata = whatever the preserved name was

The Match has to be if all criteria are met, not any.

I personally would not recommend using a different field that is more accessible.

Translate