Skip to main content
dmsduco
Inspiring
July 18, 2018
Answered

Batch rename preserving original filename AND modified date

  • July 18, 2018
  • 1 reply
  • 4993 views

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 has been closed for replies.
Correct answer Stephen Marsh

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.

1 reply

Stephen Marsh
Community Expert
Stephen MarshCommunity ExpertCorrect answer
Community Expert
July 18, 2018

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.

dmsduco
dmsducoAuthor
Inspiring
July 18, 2018

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?

dmsduco
dmsducoAuthor
Inspiring
July 18, 2018

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.


You are the man!

I did not know about the 'All Metadata' criteria.

Your solutions work perfectly, thanks!