9

Is there something I can use that renames PDF files according to their content? Basically an equivalent of http://macscripter.net/viewtopic.php?id=27620 in Ubuntu.

4

If you are comfortable with python you could use the script on http://blog.matt-swain.com/post/25650072381/a-lightweight-xmp-parser-for-extracting-pdf-metadata-in. I have just tested the scripts he provides (for a start, you can pip install pdfminer) and they work nicely. The result they give is something along the lines of:

[{'ModDate': "D:20050422142709+02'00'", 'CreationDate': "D:20050422142709+02'00'", 'Producer': 'Mac OS X 10.3.8 Quartz PDFContext', 'Creator': 'Word'}]

That output you could use to rename your files.

1
  • 1
    I have actually assumed thus far that you mean metadata with content (based on your link). There is also a good tool for academic information retrieval available. It is called pdfmeat.
    – don.joey
    Mar 12 '13 at 14:14
6

This is very easy to achieve with exiftool.

For instance, the following command would rename all files in the current directory to <title>.extension:

exiftool '-filename<$title.%e' .

You can install exiftool on Ubuntu with:

sudo apt-get install libimage-exiftool-perl

Please consult the official documentation for more information:

http://www.sno.phy.queensu.ca/~phil/exiftool/filename.html

0
3

There is another alternative. You could sudo apt-get install pdftk. With that library you can run a command like pdftk myfile.pdf dump_data which results in something in a set of info and value:

InfoKey: Creator
InfoValue: Word
InfoKey: Producer
InfoValue: Mac OS X 10.3.8 Quartz PDFContext
InfoKey: ModDate
InfoValue: D:20050422142709+02'00'
InfoKey: CreationDate
InfoValue: D:20050422142709+02'00'
PdfID0: d7af25c8df737276d8d6b5de49d94d92
PdfID1: d7af25c8df737276d8d6b5de49d94d92
NumberOfPages: 58

Again you could use that information in a renaming script. If feel the latter is something best customized because it depends on whether you just want the title, title-author, or something else.

Source

0

If you're looking for an out-of-the-box solution and your PDFs are academic in nature, you might try Zotero, the Firefox plugin.

Unfortunately this takes several steps to do, each of which can be a bit slow if you are trying to work with a lot of PDFs at once:

  1. Drag and drop your PDFs into Zotero.
  2. Right-click them to retrieve the metadata (and automatically download the bibliographic information).
  3. If the files were recognized correctly, right-click them again to automatically rename.
  4. Export or directly move the renamed files where you want them.

The answer to a similar question on Superusers shows how to do the same thing using Mendeley. In Zotero this process can be further automated using Zotfile. Finally, here is an extensive list of potentially useful tools along these lines.

0

If you are in search of a GUI solution KRename is a very powerful renaming tool, able to handle your requirements.

enter image description here

to install:

sudo apt install krename 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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