[Tutor] Add metadata to a dir of files.

Tim Golden mail at timgolden.me.uk
Thu Feb 22 18:28:44 CET 2007

> Here's my problem: I have a directory full of about 2,000 pdf files. I want to be able to add the 
> same comment to the "Category" field of each file (in the document properties of the file). So I am 
> looking to batch process pdf files (or any filetype, i guess) to add some metadata.

I'm assuming here that we're talking about the PDF's
own metadata rather than, say, the additional stuff
which Windows allows in Alternate Data Streams? If
so, then a combination of PyPDF:


and the builtin os, glob, os.path modules:


might suit the case.


More information about the Tutor mailing list