Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a number of PDFs that I downloaded from JStor. They come with unhelpful numeric filenames, but often there is at least a title if not the author in the metadata.

How do I batch rename a number of PDF's so that it will search the metadata and rename the file "Author-Title" when both "Author" and "Title" are specified in the metadata? If one is missing, I'd like it to just rename the file to reflect the metadata which is present, naming the file "Author" or "Title". If there is no metadata I would like nothing to change.

share|improve this question
1  
link This question is a near duplicate. Not quite a duplicate because he wants a solution for .pdf's without MetaData. –  Dennis Dec 23 '12 at 6:18
add comment

4 Answers

up vote 1 down vote accepted

Free Bibliography software like

can do this for you.

  • I assume that BibDesk (which is not platform independent, but much more mac-like) can also do that.
share|improve this answer
1  
I wound up getting Mendeley for this purpose. I already use BibDesk, but Mendeley seems to be better at identifying the PDFs. Thaks! –  Dennis Dec 23 '12 at 16:28
add comment

Here's one possible way, which would involve writing a script that shouldn't be too horrible.

Use JHOVE to extract metadata from the file and write it to an XML file. Use an XPath expression to pull out these paths:

jhove/repInfo/properties/property/property/property/values/value

where the three property elements in the path contain <name> elements whose value is respectively, "PDFMetadata", "Info", and "Title" to grab the title, and "PDFMetadata, "Info", and "Author" to grab the author. Then you can use these programmatically to create the new file name.

This is a rough outline, but I think the idea can work.

Full disclosure: I wrote most of the code for JHOVE.

share|improve this answer
    
This is very helpful, I'll look into figuring out how to implement your suggestion. Looking at JHOVE, it seems to be associated with JStor. Will this solution only work for .pdfs gotten from JSTOR or is it a general solution? –  Dennis Dec 23 '12 at 4:32
    
It should work with any PDF. The association of JHOVE with JSTOR is just a coincidence. –  gmcgath Dec 24 '12 at 0:25
add comment

On OS X, you can use mdls to query the Spotlight database for the properties it's extracted and indexed for the file:

$ mdls -name kMDItemTitle A-Self-Referential-Story.pdf 
kMDItemTitle = "This Is the Title of This Story, Which Is Also Found Several Times in the Story Itself"
$ mdls -name kMDItemAuthors A-Self-Referential-Story.pdf 
kMDItemAuthors = (
    "David Moser"
)
share|improve this answer
add comment

I just recently created an app to batch rename scientific papers, very useful to rename papers to make it papers more organised in term of file name.

The app works by get title from metadata. If there's no metadata it will intelligently get the correct title from the pdf. Then other advanced option can be applied to the title such as shorten to abbreviation, add date and so on.

Demo video: http://www.youtube.com/watch?feature=player_embedded&v=R01bvA9rhiQ

Can be downloaded at App Store https://itunes.apple.com/app/pdf-paper-renamer/id591593578?mt=12

share|improve this answer
    
Do you plan to port it to windows too? –  PHPst Jun 3 '13 at 8:40
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.