PDF files store a creation and also a modification time inside their metadata.
Is it possible for ExifTool to take either/both of these and update the file's creation/modification time(s) with this?. I have tried an example that worked with .JPG files, but was unable to get it to work with .PDF.
Can someone provides example(S)?, for creation AND/OR modification and for single files AND directories?.
First use this command to see what is available:
exiftool -a -G1 -s FILE
Then use this command to set the file modification date from the appropriate tag:
exiftool "-filemodifydate<TAG" DIR
- Phil
Quote from: Phil Harvey on October 14, 2017, 07:43:20 PM
First use this command to see what is available:
exiftool -a -G1 -s FILE
Then use this command to set the file modification date from the approrpriate tag:
exiftool "-filemodifydate<TAG" DIR
- Phil
Got it working. But with some PDF files the 'Hour' is a off/different by the one in the PDF meta data. For example the 'ModifyDate' from the PDF metadata for the attached file has a '11' as the hour, but when I update the filesystem one it is '2' as the hour. See the metadata below.
Can you explain why or how to correct it? (I sense it maybe a issue due to World TimeZones)
Also
The For Tags show for a .PDF file:
[ExifTool] ExifToolVersion : 10.63
[System] FileName : X.pdf
[System] Directory : .
[System] FileSize : 929 kB
[System] FileModifyDate : 2004:03:17 02:25:50+00:00
[System] FileAccessDate : 2004:03:17 02:25:50+00:00
[System] FileCreateDate : 2017:10:15 00:00:00+01:00
[System] FilePermissions : rw-rw-rw-
[File] FileType : PDF
[File] FileTypeExtension : pdf
[File] MIMEType : application/pdf
[PDF] PDFVersion : 1.4
[PDF] Linearized : Yes
[PDF] Encryption : Standard V1.2 (40-bit)
[PDF] UserAccess : Print, Fill forms, Extract, As
semble, Print high-res
[PDF] CreateDate : 2004:03:01 03:00:24Z
[PDF] ModifyDate : 2004:03:17 11:25:50+09:00
[PDF] Producer : Acrobat Distiller 5.0.5 (Windo
ws)
[PDF] Creator : PScript5.dll Version 5.2
[PDF] Title : HR-S5970E
[PDF] Subject : LPT0916-001A
[PDF] Author : JVC
[PDF] PageCount : 16
[PDF] PageLayout : SinglePage
[XMP-pdf] CreationDate : 2004:03:01 03:00:24Z
[XMP-pdf] ModDate : 2004:03:17 11:25:50+09:00
[XMP-pdf] Producer : Acrobat Distiller 5.0.5 (Windo
ws)
[XMP-pdf] Creator : PScript5.dll Version 5.2
[XMP-pdf] Title : HR-S5970E
[XMP-pdf] Subject : LPT0916-001A
[XMP-pdf] Author : JVC
[XMP-xmp] CreateDate : 2004:03:01 03:00:24Z
[XMP-xmp] ModifyDate : 2004:03:01 03:00:24Z
[XMP-xmp] MetadataDate : 2004:03:17 11:25:50+09:00
[XMP-xmp] Title : HR-S5970.5971_001EN-.fm
[XMP-dc] Title : HR-S5970.5971_001EN-.fm...There are 2 'CreateDate' tags, the [PDF] and the [XMP-xmp]. How do I select a particular one?.
Quote from: newexif on October 14, 2017, 09:33:54 PM
Got it working. But with some PDF files the 'Hour' is a off/different by the one in the PDF meta data. For example the 'ModifyDate' from the PDF metadata for the attached file has a '11' as the hour, but when I update the filesystem one it is '2' as the hour. See the metadata below.
Can you explain why or how to correct it? (I sense it maybe a issue due to World TimeZones)
Yes, since both timestamps have a timezone, there is an adjustment being made. If you wish to strip the timezone, you can use
"-FileModifyDate<${ModifyDate;s/+.*//}" to strip off the timezone.
Quote...There are 2 'CreateDate' tags, the [PDF] and the [XMP-xmp]. How do I select a particular one?.
Add the group name to the beginning of the tag separated by a colon, e.g.
PDF:CreateDate or
XMP-xmp:CreateDate (or simply
XMP:CreateDate).
I am trying the following command line, but the file's time on my filesystem is still hours away from the one in the PDF metadata.
exiftool.exe "-FileModifyDate<${ModifyDate;s/+.*//}" ExitTest.pdf
Also I get the warning:
Warning: Quantifier follows nothing in regex; marked by <-- HERE in m/+ <-- HERE .*/ for 'ModifyDate' - ExitTest.pdf
?
Sorry, my mistake. I forgot to escape the plus sign (it has special meaning in RegEx). And I should account for negative time zones as well as Zulu time. Try this
"-FileModifyDate<${ModifyDate;s/[-+Z].*//}"
The trick explained by Phil above works like a charm for me! To be clear, ExifTool is not the very thing I got used to, all the soft I was working with before in order to do some amends for pdfs like this one https://www.altoextractpdf.com/ (https://www.altoextractpdf.com/) were dead simple to understand, I would say, and didn't require any specific skills. But as I can see, Exif does all the same things and in pretty interesting manner, so there are many things to compare, I do think