Get DateCreated from XMP files in mass for PNG and JPG files -TagsFromFile

Started by Chase91, September 23, 2023, 04:42:59 PM

Previous topic - Next topic

Chase91

I have thousands of PNG and JPG files that needs to have the DateCreated date from their XMP files as their created date.  I have been able to copy the DateCreated date to the Date Taken date, but then I have to run something else to get that date as its created date for PhotoPrism to read it properly when indexing.  I am also needing to do this for thousands of files within one folder.  I am probably making this harder than it needs to be.  Although, it does seem if the date is not set as the photos created date, PhotoPrism does not pick it up properly.  Any help would be greatly appreciated.  I have spent way too much time on this.


Chase91

#1
I think I have it.. At least for PNGs.  Let me know if anyone has something better.

exiftool.exe -TagsFromFile SourceFolder\%f.xmp "-PNG:CreationTime<DateCreated" -P -ext png DestinationFolder

StarGeek

That is pretty much the command, though as long as the XMP files are in the the same directory as the images, you could use this without having to specify the source directory
-TagsFromFile %d%f.xmp

As to which tag you need to write for PhotoPrism read, you'll have to check the files.  Find one that is correct and use the command in FAQ #3 to look at all the data, the groups they belong to, as well as tags which have duplicated names.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Chase91

Quote from: StarGeek on September 23, 2023, 05:28:58 PMThat is pretty much the command, though as long as the XMP files are in the the same directory as the images, you could use this without having to specify the source directory
-TagsFromFile %d%f.xmp

As to which tag you need to write for PhotoPrism read, you'll have to check the files.  Find one that is correct and use the command in FAQ #3 to look at all the data, the groups they belong to, as well as tags which have duplicated names.

So, PhotoPrism says they take the "TakenAt" date.  I am not sure what they are referring to.  However, looking at their indexing, it appears it is actually looking at the system File Creation Date/Time date.  I have my files with the correct Date Taken at this point, but now I need to take the IPTC Date Created date and make that the system File Creation date.  Any ideas on how I can get around the date format issue in doing that?

StarGeek

They probably fill the "TakenAt" property from multiple tags, as that is common.

You would use the same command, but change the tag you are copying to.

There is a test file in this post (MetadataTestFile.zip) with about 1,400 tags already filled in. Extract it and load it into PhotoPrism and then use this command to see which tag will match what PhotoPrism shows, as each date/time tag has a different value
exiftool -time:all -G1 -a -s file.jpg

If you really want, you could then delete that tag and reload the file, eventually finding out all the tags that PhotoPrism is reading for the "TakenAt" property.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Chase91

Quote from: StarGeek on September 23, 2023, 09:24:59 PMThey probably fill the "TakenAt" property from multiple tags, as that is common.

You would use the same command, but change the tag you are copying to.

There is a test file in this post (MetadataTestFile.zip) with about 1,400 tags already filled in. Extract it and load it into PhotoPrism and then use this command to see which tag will match what PhotoPrism shows, as each date/time tag has a different value
exiftool -time:all -G1 -a -s file.jpg

If you really want, you could then delete that tag and reload the file, eventually finding out all the tags that PhotoPrism is reading for the "TakenAt" property.
I know that I need the system File Creation Date/Time date now.  However, I am having issues getting the IPTC Date Created date into that system File Creation Date/Time date.  I am getting a "Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z])" error.

Phil Harvey

The IPTC DateCreated doesn't contain a time.  Try this:

exiftool "-filecreatedate<$IPTC:DateCreated 00:00:00" "-filecreatedate<$IPTC:DateCreated $IPTC:TimeCreated" DIR

This will set the time IPTC:TimeCreated, or 00:00:00 if this tag isn't available.

- 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

The IPTC:DateCreated is probably not the best tag to copy, because, as Phil says, it doesn't have a time component.

Use the command I list above to look at all the date/time tags and see if there is a better option.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype