Updating PDF "modifydate" with the "createdate"

Started by tinsleyc, August 15, 2011, 06:41:12 PM

Previous topic - Next topic

tinsleyc

I wish I was smarter than I am, but being what it is - I am trying to understand this amazing tool for the last 1.5 hours and I am not getting anywhere.  I am hoping someone can lead me in the right direction.

We have over 100,000 PDF files being extracted from an old Canon Document Management system and need to preserve their date/time stamps as this date is an indicator of when the PDF was created.  Problem is, these PDF's are non-standard in format, as ExifTool can't completely read the file, it exits with a "Warning : Invalid xref table".  This is proven by the fact that Acrobat v10 asks if I want to save the PDF when simply opening and closing the file.  Saving a PDF in Acrobat 10 reduces the file size a bit, and of course wipes out the date stamp, making it current.  ExifTool can then successfully read it.

I plan to automatically "Optimize" these PDFs in batch with Acrobat 10 to reduce their file sizes and improve the accuracy of their text search.  I would then like to use ExifTool to put the date/time stamps back the way they were.  I see that I can run this on a sample file called test.pdf:

C:\Temp> exiftool -createdate -modifydate test.pdf
Create Date                     : 2005:02:10 20:08:04Z
Modify Date                     : 2011:08:15 16:31:07-05:00

As you can see the Modify Date is current from today, but I really want the Modify Date to be what's stored in the Create Date.

I need an ExifTool command that I can run at a top level folder, and have it apply this change to the subfolders, replacing the Modified date (as seen by the DOS "dir" command) with the Create Date? 

Any help here would be greatly appreciated!

Clay
Dallas, TX

Phil Harvey

Hi Clay,

The modify date that is seen with the DOS "dir" command is called FileModifyDate by ExifTool.

To set this date from the CreateDate information for all files in a folder called "DIR", you could use this command:

exiftool "-filemodifydate<createdate" -r DIR

The -r option recurses into contained subfolders.

Also add -ext pdf to the command line if you want to process only PDF files in these folders.

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

tinsleyc

In testing this worked beautifully...  Thank you so much!

Clay

dejai

Am looking to batch update tens of thousands of PDF files with the original 'PDF created' date, rather than the DOS/Win 'created' date the file inherits when copied

There are many programs to update and modify the DOS/Win dates, but not to extract and update from the original PDF properties

Hoping I'm overlooking something in the very excellent EXIFtool . . .

Phil Harvey

You can read/write/copy any PDF or filesystem date/time tags with ExifTool.  Use this command to see what is available:

exiftool -a -s -G1 -time:all FILE

then a command like the one I gave in the post above to copy from one to the other.

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

dejai

OK great thanks Phil very helpful, apologies for the delay in replying

[System]          FileModifyDate
[System]          FileAccessDate
[System]          FileCreateDate
[PDF]               CreateDate
[PDF]               ModifyDate
[XMP-xmp]       CreateDate
[XMP-xmp]       ModifyDate
[XMP-xmp]       MetadataDate

So to update all EXIF data (PDF & filesystem) for all PDF files recursive, I would execute the following.?

    exiftool "-FileModifyDate<CreateDate" "FileAccessDate<CreateDate" "FileCreateDate<CreateDate" "ModifyDate<CreateDate" -r -ext pdf DIR

This is by far the best tool out there without doubt.!!!

Would be wonderful if there was a GUI interface, or even a partial GUI interface    -:)

Maybe something like BRU for example (www.bulkrenameutility.co.uk)

And no I have no affiliation with them - just a happy customer . . .

Phil Harvey

Close, but you are forgetting the dash on most of your options.  Also, FileAccessDate is not writable.  So the command should be:

exiftool "-FileModifyDate<CreateDate" "-FileCreateDate<CreateDate" "-ModifyDate<CreateDate" -r -ext pdf DIR

You should read the description at the top of the PDF tags documenation for some details about how ExifTool writes PDF files.

There is a Windows GUI for ExifTool available here.

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