Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Change file creation and modification dates based on file name?

I have captured all my home movies from DV tapes and would like to set the creation and modification dates to the original date the footage was recorded. I want the footage to sort correctly in Apple Photos. Thankfully Final Cut Pro named all the footage with the correct date and time.


Tape name - yyyy-mm-dd hh/mm/ss

    • Footage 009 - 2004-10-24 08/04/55-1.mov
    • Footage 009 - 2004-10-24 17/29/07.mov
    • Footage 009 - 2004-10-29 19/05/54.mov
    • Footage 010 - 2004-11-23 11/29/36.mov
    • Footage 010 - 2004-11-23 12/22/55.mov
    • Footage 010 - 2004-11-27 10/56/45.mov


I have found a few similar questions online, but I am not sure how to modify some of the solutions to work with my file name format. Any help would be appreciated!

https://discussions.apple.com/thread/250940404

https://macscripter.net/viewtopic.php?pid=138881#p138881

iMac 21.5″, macOS 10.13

Posted on Dec 4, 2021 9:37 AM

Reply
Question marked as Best reply

Posted on Dec 7, 2021 8:05 AM

HD, thank you for your thoughts. I did some tests last night and found that changing the Quicktime Create Date caused Photos.app to sort the video properly. A $20 program, A Better Finder Attributes, trial let me change the date based on the name. So at this point it is probably easiest to purchase the program.


Thank you all for your time and expertise.

Similar questions

7 replies
Question marked as Best reply

Dec 7, 2021 8:05 AM in response to HD

HD, thank you for your thoughts. I did some tests last night and found that changing the Quicktime Create Date caused Photos.app to sort the video properly. A $20 program, A Better Finder Attributes, trial let me change the date based on the name. So at this point it is probably easiest to purchase the program.


Thank you all for your time and expertise.

Dec 6, 2021 2:04 PM in response to chadsgreene

This is little more than a text parsing exercise to extract the relevant data from the filename, so that's pretty easy.


As is often the case, though, the devil is in the details. For one, those filename are concerning - usually / is not allowed in file names (since it's used as a directory delimiter), so that may need some special handling. It's likely a legacy issue since times would usually be colon delimited (e.g. "10:56:45"), but colons are a no-no, too.


Then there is the issue of the creation date. It's simple to change the modification date of a file. It's also possible (and simple) to set a creation date that is earlier than the file's current creation date. However, setting a newer creation date is a whole other issue.


As long as the creation date is earlier you can use the built-in shell command touch. If you need newer creation dates you need to install Xcode (along with it's associated shell tools) to get SetFile, which can set any date.


As I think about it, file dates may not be the issue anyway - media files (photos, videos, etc.) often contain embedded metadata that include things like dates, resolution, data rates, etc), and modifying the metadata may be an easier path.


If you can clarify these details (specific file name formats and old vs. newer dates), I'm sure we can craft something.

Dec 6, 2021 3:51 PM in response to Camelot

The names are very consistent as shown above and oddly enough do have "/" in the name saved in the Finder. If needed I could use Automater to rename the clips replacing all "/" with "_".


All the dates are in the past. I do not have any future dates. I believe the last time I filmed with a DV camera was back in 2009.


Thank you so much for your willingness to help.

Dec 7, 2021 12:51 AM in response to chadsgreene

I can't offer an instant solution, but it may be worth considering that Photos doesn't necessarily use the system file create date to sort on, and that you may need to use something like ExifTool.


To illustrate, I ran the following ExifTool command on a .mov file:


hd@HD ~ % exiftool /Users/hd/Desktop/somefile.mov -G1 | grep -i date


This returns every line of output that includes the character sequence 'date'. '-G1' asks for the output to be preceded by the tag group name.


I got the following:


[System]        File Modification Date/Time     : 2015:02:05 15:26:06+00:00
[System]        File Access Date/Time           : 2021:12:06 23:04:06+00:00
[System]        File Inode Change Date/Time     : 2021:12:06 22:58:09+00:00
[QuickTime]     Create Date                     : 2015:02:05 15:23:57
[QuickTime]     Modify Date                     : 2015:02:05 15:24:07
[Track1]        Track Create Date               : 2015:02:05 15:23:57
[Track1]        Track Modify Date               : 2015:02:05 15:24:07
[Track2]        Media Create Date               : 2015:02:05 15:23:57
[Track2]        Media Modify Date               : 2015:02:05 15:24:07
[UserData]      Content Create Date             : 2015:02:05 15:20:31+00:00
[Keys]          Creation Date (und-GB)          : 2015:02:05 15:20:31+00:00
[Keys]          Creation Date                   : 2015:02:05 15:20:31+00:00


So, apart from the three System tags, there are date and time creation and modify tags in the QuickTime, UserData and Keys groups as well as date/time tags for the individual Tracks within the movie. Some include timezone information, some do not. As I understand it there is no exif tag group.


The ExifTool QuickTime Tags page appears to suggest that most if not all of these tags can be edited with ExifTool, but as I say, I'm honestly not sure which you would need to change (probably all). And writing the correct command is beyond my limited skills with ExifTool.


At this point I would suggest raising your original question on the ExifTool Forum. It's active, friendly and very knowledgeable and may well give you a working solution for all your files, without involving Automator.


Cheers,


H


Change file creation and modification dates based on file name?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.