Prefix Image/Movie Files with Date Taken or Date Modified

RenameToTaken

RenameToTaken.js.txt (6.4 KB)

Prefix image/movie files with a date and time stamp whilst retaining the original file name stem (in brackets) for easy restoration.
Uses date taken metadata if available, otherwise uses date modified.
e.g. myfile.jpg is renamed to 20200609_123456_tkn_(myfile).jpg or 20200609_123456_mod_(myfile).jpg
Operates on selected files, ignoring those that are not recognised as images or movies.

Installation: Save the attached RenameToTaken.js.txt file to Script Addins then use as follows:

  1. RenameToTaken
  2. RenameToTaken CFG
  3. RenameToTaken MOVE
  4. RenameToTaken REVERT

(1) Rename elegible selected files.
(2) Open the configuration file.
(3) Rename elegible selected files and move to YYYY/MM structure.
(4) Restore original file names.

Unless disabled in the configuration, the ctrl qualifier key can be used to open the configuration file as an alternative to (2).
Unless disabled in the configuration, the shift qualifier key can be used to move to YYYY/MM structure as an alternative to (3).

History:

20200611 v1.0

Sample before / after without move / after with move to YYYY/MM

1 Like

Any reason to do this as a button-script rather than a rename script?

I think doing it as a rename script will give you better undo support, and also let you preview the results in the Rename dialog before applying them (if you want to). Rename scripts have access to the same metadata objects.

Button scripting is familiar territory. Maybe this is my opportunity to take a closer look at rename scripting.

1 Like

Rename scripting should simplify the task, since you don't need to worry about iterating through the selection, or running commands, or any of that; you just need to return the new name that you want for each file.