Renaming all Files with Parent Metadata

Zotero has this context click option to 'Rename File from Parent Metadata' which renames PDFs (or whatever) to something useful which pertains to the contents. It would take a very long time for me to manually go through every PDF in my collection to rename it with this function so I was hoping there might be some way to get Zotero to do this automatically to every file (appending the name with a number to avoid conflicts if necessary).
  • Note that Zotero now does this automatically by default for new files that you add.

    You can do this for multiple items by doing a search that matches multiple attachments (e.g., a saved search with Attachment File Type is PDF) and then using Select All (which will select only the matching items) and the context menu option.
  • Thanks very much!
  • Zotero also gives you some control of how the file names will be formatted, you'll find more information here: https://www.zotero.org/support/preferences/hidden_preferences .
  • I have tried several approaches to batch rename PDFs from parent metadata, for a possible solution see https://forums.zotero.org/discussion/62697/orphan-attachments. If you have many duplicate files, as often happens when shifting versions, back-ups, or other global file system changes try one of the many duplicate file finders instead of searching manually.
  • Hi guys I am new to Zotero. I need to right click on a file to rename it. Ive read hear and elsewhere that it should happen automatically. Are you able to advise if there is a setting I need to change. I can't seem to find one. Thank you in advance.
  • You can attach the file to an item in Zotero, and then, when you right-click the attachment in Zotero you will see an option "Rename File from Parent Metadata". There are more advanced options for renaming and moving files with the add-on Zotfile.
  • I think the question is why this doesn't happen automatically. The answer most likely is that it does and you're just not seeing it: Zotero automatically renames the file, but that's not reflected in the file _label_ in the middle panel. Have you checked the actual filename? (in the right-hand panel or when using "Show File" on the file

    If so, how exactly are you adding these files?
  • I see that directly-imported *PDFs* are now automatically renamed. This is a great feature. However, when I save a reference from a web page containing a link to a PDF, it would be great if the automatically-downloaded PDF could be automatically renamed as well. I currently do this manually for every article that I save. Could this option be added in the future?
  • @calvinke: Automatically downloaded PDFs have always been renamed. See adamsmith's comment directly above yours.
  • @dstillman you are correct - the automatically PDF does get renamed when I view the actual file. It's not reflected in the file label in the middle panel as @adamsmith said. I did try to restart the program and the old file label is still shown. Any way to update the file label automatically?
  • edited January 30, 2019
    It's not showing the "old file label" (which doesn't exist, because these are new files). It's showing the attachment title assigned by the translator, which serves a different purpose.
  • Got it. So I guess if I want to change the attachment title then I would need to manually update it, but there isn't a need to do this per se.
  • edited January 30, 2019
    You can click on the attachment title in the right-hand pane to change it.

    Edit: Sorry, misread. Yes, that's right — there's no need to change the attachment title unless you want it to display something different. (E.g., some people note whether it's an annotated version of the PDF.)
  • edited January 25, 2020
    Using Zotero 5.0.82

    Thanks @rooots for the tips on the hidden preferences described in https://www.zotero.org/support/preferences/hidden_preferences.

    My chief concern as a Linux user is **not getting** spaces within file names, for this complicates the file handling at the command line and other inconveniences. I have thus modified the string in the hidden preferences into something like {%c-}{%y} and so forth.

    The problem is that, if the item has been produced by Stanley and Laurel, the placeholder %c will give the string "Stanley and Laurel" with whitespaces, so defeating my purpose.

    Question one: is there a way to have a finer control on the syntax of %c?
    Question two: is there a full list of the possible placeholders? For example, I would want to include the journal title instead of the article title.

    If these features are not present or accessible, please add to the wishlist.
  • @dstillman what is a 'context menu' re your post of March 23, 2018?
  • context menu = right-click on items.
    For more fine-grained control on file naming, use the Zotfile add-on (zotfile.com)
    The built in renaming just has the cty options and they can't be customized beyond the character limit for titles noted in the documentation.
  • @Xavierstuvw: I'd encourage you to reconsider your opinion on spaces in file names, though — that's a pretty outdated view. All modern operating systems, including Linux, support spaces perfectly fine, and have for many years. (Zotero has used spaces in filenames on all platforms since it was created in 2006.) If you don't want to type backslashes at the command line, use tab completion. All you're really doing is making filenames harder to read unnecessarily.
  • I agree with @Xavierstuvw the issue of spaces within filenames.

    Regarding to Zotfile there are a couple of problems. One is that it does not have the instruction *Rename File from Parent Metadata*, so it is not automatic to do it (or at least I didn't find how to do it). The other problem is that it seems that it will not have a very long future (https://github.com/jlegewie/zotfile/issues/522#issuecomment-806630585).

    Even modern OS support spaces, it is quite convoluted to manipulate them (tab completion is not useful when many files start equal, as is the case of papers by the same author). On the other hand, the hard or soft of reading filenames with let's say, underscores is just individual's opinion. Moreover, thanks to Zotero, we do not have to focus on searching for pdf filenames, but on Zotero database.

    So it would be great of having an option, as in Zotfile, for *Replace blanks*
  • Zotfile’s rename function is under the Manage Attachments menu. It can also be set to be automatic on import.
  • Thanks @bwiernik, I didn't see inside the Manage Attachments menu.
  • @dstillman

    "... and then using Select All (which will select only the matching items) and the context menu option."

    The context menu doesn't appear in the advanced search box, neither on MAC or Windows. Is this something that was lost along the way?
  • For anyone that wants to know, if you "select all" in the search window and press enter, it'll bring everything into the main window and THEN you can right-click to the context menu and choose Rename....
  • edited January 27, 2023
    The context menu doesn't appear in the advanced search box, neither on MAC or Windows. Is this something that was lost along the way?
    @andreemcaron: No, this is about a search in the main window — either using the quick search bar or a saved search created from an advanced search (or, as you say, selecting the items in the advanced search window to select them in the main window).
  • Is this option missing in Zotero 7?
  • I think so. I came here because I can't find that option anymore.
  • right-click on an attachment -- Rename File from Parent Metadata
    is still available in Zotero 7 as it has always been. ZotFile is not compatible with Zotero 7, although Zotmoov duplicates most of its functionality.
  • edited 24 days ago
    Hello,

    "Rename File from Parent Metadata" is still available. But I guess multiple item renaming is not a thing anymore.

    Automatic renaming is nice, but it may not be enough. Because many items need to be edited or corrected later. For this reason, for example, it would be nice to be able to completely rename the items in the sub-collection I created in preparation for the courses.

    Regards,
  • @altugkoc: No, this hasn't changed. It still works on multiple selected attachments, as it did before.

    A future version will offer continuous renaming, so files will be renamed as you make manual changes to the metadata.
  • This is great, thank you.
Sign In or Register to comment.