[Tutor] Add metadata to a dir of files.

Kirk Bailey deliberatus at verizon.net
Fri Feb 23 04:55:24 CET 2007

Mark Bystry wrote:
> Ok. I'm not sure what programming language I want to try this in...since I'm not sure how to write 
> this in any language (thought I'd give python a try.
> 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.
Just as a shot in the dark, try this as a first guess at proceeding:

# filelist is a list variable; each *.pdf file name is an item in the
# list variable.
#now we will walk the list, doing the same trhing to every item.
for file in filelist:	# do the same stuff to every file listed

See if thie helps getting something started. I know nothing about how to 
insert data into an existing pdf file, can you advise?

> My needs are very similar to tagging mp3 files.
> Since I'm still new to python I don't even know how to get started. Can someone provide sample code 
> that maybe I could expand upon or point to a link somewhere so I can read up on the subject?
> I would appreciate it.
> Thank-you,
> Mark
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor

	-Kirk Bailey
          | BOX |


More information about the Tutor mailing list