Movie files "year" in Windows.

Started by lepaul, January 13, 2023, 10:18:31 PM

Previous topic - Next topic

lepaul

I apologize if this particular thing has been answered, but I haven't found it. The closest answers have been here and here.

I have had no issues using the exiftool to modify dates using a few different commands such as this:

exiftool "-alldates<filemodifydate" path\to\directory\or\file
I realize that's a sledgehammer way to do it, but it works on the files I have right now.

But I want to grab the year YYYY and drop in the ContentCreateDate so it will fill in the year. Is it possible to parse the year and send it to that meta field via the command line? The methods in the links I posted above are manual solution for each individual file. 

Thanks! Love the utility and appreciate any help.

Phil Harvey

Sure.  You can do this:

exiftool "-ContentCreateDate#<filemodifydate" -d %Y path\to\directory\or\file

Note that you need to write the "numerical" value of ContentCreateDate because the date/time formatting doesn't work for a year-only value.  This is the reason for the "#".  Also note that ContentCreateDate is a QuickTime tag, so it may only be written to QuickTime-format files (eg. MOV, MP4).  As well, it may be written in 3 different locations in QuickTime (ItemList, UserData, Keys), and if you don't specify where ExifTool will write it in the ItemList by default.

If you also want to set AllDates in the same command it will get a bit more complicated, and you would need to use the advanced formatting feature with the DateFmt helper function:

exiftool "-alldates<filemodifydate" "-ContentCreateDate#<${filemodifydate;DateFmt('%Y')}" path\to\directory\or\file

I feel I'm dumping a lot of new information on you for your first post, but hopefully it won't stress you out too much. :P

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

lepaul

Quote from: Phil Harvey on January 14, 2023, 07:59:06 AMI feel I'm dumping a lot of new information on you for your first post, but hopefully it won't stress you out too much. :P

- Phil

THANK YOU sir!  That nailed it for me.  Not too much info at all, and I appreciate you taking the time to give such a detailed reply.  I'm still learning about this as I go, but exiftool has already saved me many hours on some other projects where the modifications were simpler.  Much appreciated!

StarGeek

You can look at this post to see what tags need to be written when filling the Windows Properties.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

lepaul

Thanks! My next challenge is to fill metadata properties from the elements of the file name.  Got some reading to do. :)