File Renaming - Batch rename filenames from parent metadata

Hi, I checked the discussion board and I didn't find an answer for my question.

In Zotero 7, if I change the 'Filename Format', how can I then apply these changes to my files/attachments? I cannot highlight them them since, the 'Rename from Parent Metadata' button is now only available for the attachments, not the library items, so I cannot even 'Ctrl+A'. I have over 4000 files (one file per item), how can I rename these? Is there a way and I am just missing something obvious?

Thanks for your work!
  • We're working on an improvement in this area. In a future version, you will be prompted after making a change whether to apply the new filename format to all files in your library.

    For now, as a workaround, you can do the following:

    1. Select Tools → Developer → Run JavaScript
    2. Check "Run as async function"
    3. Paste the following code:

    items = (await Zotero.Items.getAll(Zotero.Libraries.userLibraryID, false, true))
    .filter(i => i.isFileAttachment() && !!i.parentItem && Zotero.Attachments.isRenameAllowedForType(i.attachmentContentType))
    .map(i => i.itemID);
    ZoteroPane.selectItems(items);



    4. Press Run. Zotero might freeze for a second or two.
    5. Afterwards, in your main Zotero window, attachments that can be renamed should be selected, and you should be able to run "Rename from Parent Metadata" from the context menu of any of the selected items.
  • That is nice to hear. Thank you so much, I will try. And thanks for the fast response!
Sign In or Register to comment.