Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'd like to know if there's a CLI command to get the "Created" timestamp from the "Document" tab (from file properties of a PDF) in the CLI?

I know that I can use stat to get Access/Modified/Changed info from the filesystem, but with the meta-data in the "Document" tab being embedded in the file itself, I'm not sure how to go about extracting it via the CLI.

The reason I need to do this is to create a list of filenames along with "Created" timestamps for about 22,000 PDF files. Obviously, this is something far better suited to the CLI than the GUI.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

If you install the poppler-utils package, you can do this using the pdfinfo command. For example:

$ pdfinfo OBEX-1.3.pdf 
Title:          Microsoft Word - OBEX13.doc
Author:         Daphne
Creator:        PScript5.dll Version 5.2
Producer:       Acrobat Distiller 5.0.5 (Windows)
CreationDate:   Wed Feb  5 11:12:32 2003
ModDate:        Wed Feb  5 11:12:32 2003
Tagged:         no
Pages:          95
Encrypted:      no
Page size:      612 x 792 pts (letter)
File size:      545666 bytes
Optimized:      yes
PDF version:    1.3

You should be able to extract the creation date from this output using standard tools like sed or awk.

If you want something a bit more programatic, you could use the poppler library directly. There are bindings for many popular languages including Python (through the python-poppler package).

share|improve this answer
    
thanks, that's exactly what I was looking for! –  Joseph Mar 12 '12 at 7:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.