How to automagically rename PDFs

There was a time when being a researcher meant spending many, many hours in university libraries. Nowadays every paper is available as a PDF, and you can grab papers with a tablet while sitting in a cosy armchair.

One headache is that every publisher uses their own naming convention for PDFs, meaning that organising them is a pain. This article describes how to automagically rename PDFs so that it’s easy to organise them. Here’s an example of the end product:

I name files with the first author and date, but this method works with other naming schemes too.

Tools

The tools I use to organise my papers are:

  • Dropbox, so I can access the PDFs on all my devices
  • Goodreader, a great PDF reading/annotation app on iOS
  • Zotero, which organises PDFs

Zotero is meant to be a central store of PDFs itself, but I don’t use it for that; it doesn’t handle duplicates well and I spend more time un-confusing it than it’s worth. Also it doesn’t work well with PDF highlighting software. I only use it to rename PDFs sensibly, and I remove them from Zotero when I’m done.

You don’t need to use Dropbox and Goodreader to follow this guide, but if you do you’ll end up with a lovely interface like this:

One-time Setup

These are the steps you need to follow just once on a PC, to set it up for renaming files. I’ve only done this on Windows, though it should work on Mac/Linux.

  1. Install Zotero

2. Download the Zotfile plugin from here; clicking ‘Download’ should get a file with a name like zotfile-5.0.16-fx.api.

3. Click on Tools/Addons in Zotero:

4. Click on the ‘settings’ wheel at the top right, select ‘Install Add-on From File’ and point it at zotfile-…-fx.api.

If it works, you should see this new entry in the Add-ons window:

5. Now you need to tell Zotero how you want to name files. Click on Tools/ZotFile Preferences. Open the ‘Renaming Rules’ tab, and set your rules like this:

The ‘{%a} {%y}. {%t}’ is the key part that produces this naming scheme:

You can tinker with the settings if you want something different. I do recommend leaving ‘Truncate title after . or : or ?’ switched on, as those characters cause problems for various tools.

6. Open up File/Preferences in Zotero and check you have ‘automatically retrieve metadata for PDFs’ and ‘automatically rename …’ switched on:

Renaming PDFs

  1. Put the PDFs you want to rename into one folder on your PC. I have a Dropbox folder called ‘Transfer’ that I use for this; any papers I grab, on any device, go straight in there.
    The steps below won’t delete any files from the Transfer folder, so if anything goes wrong, you can just remove files from Zotero and return to this step.
    I normally rename around 100 papers at a time. The first time you try this, I’d limit it to 20 files or so, to get the hang of the process.
  2. Start Zotero. This guide assumes you don’t use it for long-term storage, so you shouldn’t see any papers in it:

3. Drag the PDFs from the ‘Transfer’ folder into Zotero. After a little while, you’ll see something like this:

That progress bar takes forever. You may want to have a …

Wait, what? Do people put daisies in tea? Is that a thing?

4. Close the dialog; you’ll see most of the papers given sensible names:

5. Typically 5–10% of papers aren’t detected properly. If you sort by ‘Item Type’, you’ll see them listed as ‘Attachment’. These need manual renaming. Select them in Zotero, and then drag them out of Zotero and into to a sensible folder on your PC (e.g. ‘Transfer/To Rename’).

Now go back to Zotero and delete those undetected papers!

5. Make an empty folder to store the automagically renamed files; e.g. ‘Transfer/Renamed’. Open Tools/ZotFile Preferences and set ‘Custom Location’ to point to the folder you just created:

6. Close the dialog and select all the articles (Ctrl + A). Right-click and select Manage Attachments/Rename Attachments.

8. Click ‘OK’; you’ll see a long progress display scrolling up on the right. When it’s done, go to ‘Transfer/Renamed’; you should see something like this:

No original files have been deleted/renamed, so if anything goes wrong you can delete the ‘Transfer/Renamed’ folder and retry.

9. Some of the papers may have a missing year or author; it’s easiest to fix that by hand at this stage. This is also a good time to manually rename the ‘To Rename’ files from step 4.

10. Once you’re happy with the results, delete the original files from the ‘Transfer’ folder. Also delete all the files from Zotero, so you don’t come back in a couple of months and wonder if they are safe to delete.

And, you’re done! Sort the renamed papers into whatever folders you want to by topic. Don’t miss all the time you used to spend in libraries.

Andrea Izzotti

Maybe miss it a little.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
criticalscience

Key science, with sources. Minus bad statistics. Minus shaky methodology. Minus politicisation, left or right.