YYYY MM and DD into csv?

Started by billyg, April 22, 2023, 08:50:23 PM

Previous topic - Next topic

billyg

Hi there,

I'm exporting data to a CSV file and am having a hard time trying to find a way to get "YYYY" "MM" and "DD" fields. I know i can grab the capture data, but is there a way to get these fields from exiftool into the csv?

This is what i'm currently using:
exiftool -csv -createdate -sourcefile -objectname -description * >2017.csv

Phil Harvey

The problem seems to be that you want separate year, month and day columns for the date.  I can think of a couple of possibilities, but neither is trivial.  It would be simpler to just keep the date together in one field and format it as desired.  For example, to change it to "YYYY-mm-dd":

exiftool -csv -createdate -sourcefile -objectname -description -d %Y-%m-%d * >2017.csv

If you really need to split the date into 3 separate columns, the cleanest method may be to create 3 separate user-defined Composite tags which each reformat CreateDate as required.  An alternative would be to use the -p option to manually format the CSV yourself and use the advanced formatting feature to trim CreateDate as necessary for the year, month and day columns.

I don't have time right now to go into more detail, but this should at least let you know this is possible and point you in the right direction.

- 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 ($).

StarGeek

There isn't a "SourceFile" tag.  It's something automatically created with the -csv option.

It might be just easier to split the date in a spreadsheet.  Example
* 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).

billyg

Yeah, was thinking maybe this could be done by exiftool. But works just as well for me to do it in Excel. Thanks for your help!