Script requested for changing dates
<unnecessary background>
Photos has an awkward bug to import all videos in today's date. The "excuse" is that the date does not exist in the file metadata in videos. However, it appears in the File data (visible in Finder in the List view and easily editable in many third party apps). So all users know when their video was shot or modified, until they... make the mistake to entrust it to the library of the Photos App!
</unnecessary background>
Using a third party app, I have easily batch renamed all my photos and videos in the following name format (and I urge users to do the same):
YYYY-MM-DD-HH-MM - ParentFolderName - OriginalFilename.jpg
(the first part is the date and time the file was created)
The videos have been imported in Photos App using these long filenames above.
I need a script that for a given selection of pictures or videos in the Photos library, it will be copying the date and time from the first part of the filename and then pasting it to the actual date and time of each picture/video (field-by-field).
The script can be based on the known script of Leonie: Script: Batch Change the Date and Time to a Fixed Date.
The script will provide a workaround which will finally solve this very troubling date issue for many Photos users.
MacBook Pro 16", macOS 10.15