Photos for Mac

Script needed to change the create date on files

I posted this on the iMovie forum, and a user suggested that the people in the photos forum might be able to help me:

My problem is that at some point in the past years, maybe in copying or backing up and restoring data, the create dates of my movie clip files do not all match the real date they were shot. The real date is embedded in the metadata and came over in the file from the camera saying correctly what date and time the clip was shot. The Create date shown on the clip file in finder is just the date that file was created in Mac OS. So if I have a clip shot in 2004, and take a copy of that file – the new file will have a create date of today, but its metadata will still correctly show the clip was shot in 2004.

iMovie 9.0.9 correctly used the metadata to order the clips with in the event library. So this was not a problem. But I am being forced to upgrade to the newer iMovie 10 and iMovie 10 seems to use the Mac OS file create date to sort the movie clips in the event library – which is madness in my opinion – but that is what is causing my issue.

Many of my clip files have Mac OS create dates on the file which does NOT match the metadata of when the clip was shot. So when I upgrade the whole library will be a mess and out of order

If Movie 10 used the metadata, then all would be good. But it doesn't and so the only way round the issue I can see is to change every single clip file I have and change the Mac OS create date to match the embedded metadata of when the clip was shot

Luckily the metadata date is also used in the file name convention of the clip and os here is what will fix my issue:

A typical clip file is called this : 

/Volumes/SSD1TB/justin/Movies/iMovie Events/2004 Aug Ben at 9 months/clip-2004-08-17 18;58;

I need a script to strip out of the file title he relevant date and time information to input into the terminal command TOUCH. So in the example above I need the terminal command to say 

Touch -t 200408171858.38 /Volumes/SSD1TB/justin/Movies/iMovie Events/2004 Aug Ben at 9 months/clip-2004-08-17 18;58;

This command line run in terminal will change the create date to correctly match the date the clip was shot (in this case 2004-08-17 18;58;38)

So if anyone can tell me how to write the automated script so that the date and time info is collected out from the file name format as shown above, and then and used to generate the command line code to change the create date of the file

And then to be able to batch together a list of files for that script to run against

This would provide a fix for my issue

Can anyone help please?

Click to rate this post!
[Total: 0 Average: 0]

Related posts

stuck on preparing to import


Where do you find duplicate photos to edit in photos?


How can I add the share via email option to Photos without using OSX Mail as my default email app?


Leave a Comment