Zotero stopped automatically renaming files

I recently noticed that Zotero sometimes does not autonamically rename PDF files (attachment names).

In Settings I have checked both 'Automatically rename files' and 'Rename linked files'. Sometimes it does work and I can see attached PDF file change name real time, but sometimes not, and then I have to run "Rename Files ...". Last time I had around 20 PDF files needing a name update.
  • tnajdek Zotero Team
    edited 20 days ago
    The most likely cause is that those files were renamed manually at some point. When a filename has been manually modified, Zotero treats it as intentional and skips automatic renaming for that attachment going forward.

    To reset them, you have two options:
    • Rename Files... (what you've been using) -- resets all attachment filenames back to the template.
    • The rename icon next to the filename in the attachment pane -- does the same for a single file if you only want to fix one at a time.
  • I did mean the name of the PDF file itself, in my File Explorer, i.e. filename.

    It says "Zotero automatically renames files on disk based on parent item metadata such as the title and authors", and I set mine to be e.g. "Smith [2001] - The best study". However, Zotero for some reason, sometimes, just stops renaming them automatically.

    I would link a PDF file to Zotero, then use Tools>Manage Attatchments>Convert Linked Files to Stored plus Normalize Attachment Titles. And for the most time it works as intended. But sometimes it would convert the file and write 'PDF' under parent item in Zotero, however, when I go "Left Click>Show File", the filename would still be "abcdf1221ff".

    It would remain like that until I manually run Configure File Renaming>Rename Files. And yes, the options "Automatically rename files" as well as "Rename linked files" are ticked.

    I think @tnajdek could be right, but I didn't have the time to test it with new and previously renamed files. I'm unsure if he meant that filename was renamed before putting it in Zotero or after, because I do not do that.
  • What I am experiencing is that while it correctly renames it upon import, it does not keep it up to date, which, according to here it should since Zotero 8 (I am on 9).

    For instance, when a translator's name was incorrectly imported as "author" it renamed the PDF with both creators (I have this pattern: `{{ firstCreator suffix=" - " }}{{ year suffix=" - " }}{{ title replaceFrom="([:?].*)" }}`). But when I changed the field from "author" to "translator" the PDF name wasn't updated.

    And unfortunately, since the previous "Rename PDF" context menu item is now gone since it's obsolete, I can't even manually trigger a rename (other than from the application preferences).

  • If you expand the item to display attachment in the main pane, you should see an icon to the right of the filename field in the attachment info pane:
    https://s3.amazonaws.com/zotero.org/images/forums/u2119014/34wci409zv5jfdm3iy3w.png
  • edited yesterday at 10:29am
    @jandavid if by not keeping it 'up to date' you mean the automatic name change that should occur when you change any relevant metadata, there is a preference which determines if that happens ...
    extensions.zotero.autoRenameFiles.onMetadataChange

    It's True by default, but if renaming is not working as it should be, it's worth checking if yours is False.

    I prefer to set mine to False (I know it says above that Zotero respects any manual name changes and then no longer attempts to update the name when the metadata changes, but that wasn't by experience at the time I changed the setting).
  • We're investigating a bug where automatic file renaming does not trigger if the item type has been recently changed. If that's the case, automatic renaming for that item might be broken until Zotero is restarted. We will fix this.
  • Great, thanks for both of your feedback.

    @tim820 yes, `extensions.zotero.autoRenameFiles.onMetadataChange` is set to `true` – so that's not the issue.

    @tnajdek In my case the item type has not been changed, only the "field type" (from "author" to "translator") – but perhaps it's the same bug?



  • In my case the item type has not been changed, only the "field type" (from "author" to "translator") – but perhaps it's the same bug?
    The item type change bug is confirmed and will be fixed. In the current version, it's possible to get into a state where file renaming will not be triggered for that item until Zotero is restarted, by changing the item type. Can you reproduce your problem fresh after restarting Zotero? Also, is this your personal library (not a group library)?
  • @tnajdek, thanks for following up:
    I restarted Zotero and it worked. I changed the translator back to author, and it did rename the PDF with both names.
    FWIW, the item type was never changed for this particular item, however, I did recently change the type of another item – so perhaps that might have still produced that state you mention.
    But it works fine now, thanks for helping out!
Sign In or Register to comment.