Change file extensions of (many) attachment filenames

edited November 9, 2018
I recently converted a large quantity of Zotero attachments previously saved as MAF files (Mozilla Archive Format is no longer supported in Firefox) back to HTML files. The new HTML files sit in the same storage directory as the old MAFs, which have not been deleted. Same filenames, but for the different extensions.

Is there any way to change the extension of the filename associated with each attachment, besides doing so manually, one by one? Neither ZotFile nor Zutilo appear capable of this.

To be clear: the idea is neither to move the underlying file, nor even to rename the file itself, but to change the "associated filename" field within Zotero's database -- i.e., to change the way Zotero recognizes the attachments and finds them, without affecting the stored files themselves.

I couldn't find any discussion that addresses this particular issue. But if there is one, please point me to it.
  • edited November 9, 2018
    I'll just go ahead and update this. I managed to use a SQLite editor to manually replace filename extensions and type information in the itemAttachments table of the database. I used the UPDATE and REPLACE commands together to change both the 'path' and 'contentType' fields on all MAFF items.

    If you don't know what that means, don't try it. There are all kinds of caveats to this solution, especially if you sync your library and file storage across devices. And, of course, close Zotero and back up everything first.

    But, I'm happy to say, this worked. It would still be nice to know if there were a cleaner, safer approach.
Sign In or Register to comment.