ZotFile - Advanced PDF management for Zotero

  • Hi Joscha,

    I had another feature request for the zotfile plugin. Perhaps this is also as easy to implement as the renaming of patents.

    It would be nice, if one could also rename pdf's which are already attached to a zotero item according the given rules: If I click the zotfile button on a pdf file already attached to a zotero item, the renaming of this pdf file should go according the naming convention given.

    This would be nice for me, to rename the plenty of not correctly renamend pdf's in my zotero lib ;-).

  • I agree that the child/attachment rename would be awesome! Especially with the patent rename fixed.

    regarding SiGi's two posts, here are two recent threads on PDF renaming and patent dates.
  • edited June 4, 2009
    Child file attachment renaming is supported natively in Zotero 2.0b5, available now. Discuss on the relevant thread.
  • SiGi, can you explain further and give a concrete example with a "priority number" and the "date of priority"...

    I will add an option to the plugin which makes it possible to use Zotero's rename convention so that zotfile works better with the new child file attachment renaming.
  • Hi Joscha,

    here some examples for priority information:

    From espacenet it look like: US20070620011 20070104 or like EP20070122030 20071130 (the first part is the country code (EP) followed by the application number, the second part corresponds to the date of priority YYYYMMDD). This priority information is put into the priority number field by the zotero espacenet translator.

    Most zotero translators do not fill the zotero priority number field . You have to complete it by hand.

    I fill this field in this kind "priority date-priority number", e.g. 20071130-EP-20070122030.

    So it is a bit difficult to automatically extract the priority year out of the zotero priority number field.

    As you can see in the previous post, there are discussion concerning the "dates of patents". Perhaps the translators and the zotero patent item fields will change in future.

    Therefore I recommend to evaluate the "date" field, which has to be set by hand, as a second year information.
  • Here is a new test version. %y is the year extracted from the date field and %u the year from the issue date field.

    Let me know whether it works...
  • Hi Joscha,
    it works fine. And special thanks to your fast feature implementation.

    As I know, there exists 3 different solutions on automatically renaming pdf's meanwhile. (Sure with sligthly different features). Your zotfile plugin, the zotero 2.0b5 rename feature (as mentionned by Dan in this post) and a plugin called zoteRename http://www.tc.umn.edu/~kjamison/zoterename/. Perhaps all the ideas and further work could be bundeled to form the best solution for the users.
  • edited June 8, 2009
    I especially appreciate the configurability of the ZotFile renaming preference in that it can be set to only include the first author and to leave out et al, so that a file that Zotero (or Zoterename) would name
    Smith and Johnson - 2008 - Title or
    Smith et al - 2008 - Title
    Zotfile names
    I find this to be much more consistent and space-efficient across a large library of PDFs.
  • I agree with you. The renaming preferences for zotfile are actually the best.
    But for me the in-zotero renaming feature would be also very attractive, also the multiple renaming of pdf's (as it is integrated in zotero 2.0b5). But the best way would be for me, when this could be done following the same rules as I set in the zotfile preferences.
  • edited June 10, 2009
    Here is the updated version (1.0.3). It supports a separate renaming rule for patents (.renameFormat_patent) and adds a new option which allows you to use Zotero's renaming rule instead of zotfile's mechanism (.useZoteroToRename). This is useful in combination with the new child file attachment renaming in Zotero 2.0b5.


    I haven't thoroughly tested it. So let me know when it doesn't work...
  • Joscha - Thanks for the great work you've done on zotfile. I was wondering, would it be a great amount of effort to include, for naming conventions, the elements of volume/issue numbers? I have a large collection of PDFs from a few specific journals that I keep in Zotero that I'd like to be able rename as such:

    Volume#.issue# - Author - Title

    This would make it possible for me to sort through the (several hundred) PDFs easily outside of Zotero (as I export/backup the PDFs in multiple locations for several colleagues to access) - the date itself is not enough because there may be 4-5 issues each year. While this would narrow down the list to "1993," for example, it would still leave in some cases up to a hundred PDFs that are all from issues in 1993.

    I don't know if this would be too much extra work, but I figured I'd never know if I didn't ask!
  • needles, this should work. Please let me know whether it does so that I can finalize the modification and put it on the webpage as the stable version.

    %v is the volume # and %e the issue

  • Joscha, that works fantastically. I'd love to be able to use periods to separate the volume and year, but that's something I can easily do in a batch rename after the fact, so it's not absolutely necessary. :)

    The way I'm using it, and it's working great, is %v_%e - %a - %t . It gives the following result, for example:

    56_2 - Newkirk - The Dogma of Transformation

    Great stuff, and thanks for the modification!
  • okay, I have put the new version on the webpage (1.0.4). I have added two things:

    1) %v for journal volume and %e for journal issue

    2) Using the ZotFile Rename Function for other Zotero Features
    I have added a short description to the webpage which allows you to use zotfile's renaming function for other zotero features such as the zotero 2.0b5 child file attachment renaming (it might also work with the zoteroRename plugin but I am not sure about that). This is something SiGi and others mentioned in earlier posts.

  • Joscha

    First, once again, I'd like to thank you for writing and supporting zotfile, which, for me, turns a very useful application into a killer one.

    May I make a small request, please? At present, if one runs zotfile on an entry to which a file has already been attached by zotfile, then the original attachment is automatically overwritten by the new one. This is inconvenient. Sometimes one wants to attach two files to the same entry (e.g. different versions of a paper). Moreover, if one runs zotfile by mistake on the wrong entry, then the original attachment is overwritten and lost for good.

    So, I wonder, could the plugin be modified, please, so that it checks to see if an attachment with the target name already exists, and, if one does, gives the user the option to choose between overwriting it or using a different name for the new attachment (e.g. appending a "2" at the end).

    If that could be done fairly easily, then I think it would be a very useful feature.

    Thanks again!
  • While I'm at it, may I add a second request please, relating to the rename function?

    I like zotfile's rename function and prefer its rules to those of the new zotero functions. However, there is one niggle, concerning editors' names.

    At present, zotfile omits editors' names from filenames. In the case of book sections, this is fine, of course -- one just wants the author's name. But in the case of edited books, I'd prefer to include the name of the editor or editors. Otherwise, the filename comes out as _year_name.pdf.

    Would it be possible, please, to add a setting to allow the user to choose to include editors' names when renaming whole books (but not book sections)? Again, I think it would be a useful feature.

    I hope you don't mind my making these requests. They reflect how much I use your plugin and how useful I find it.
  • Keith - while Joschas plugin still has some small advantages I would argue that it has to a significant degree been superseded by Zotero 2.0bs ability to rename files from Metadata - while that function doesn't automatically attach files it does work very well with two attachments to a single item. If you're using 2.0 just right click on a linked item to rename the file. If you're still on 1.0.10 consider upgrading.
  • adamsmith -- Thanks for your suggestion. I've tried the 'rename from metadata' function, but there are some drawbacks for me: (1) I prefer zotfile's renaming rules (e.g. use of underscores rather than dashes), (2) the rename rules are not configurable (unless I've missed it), and, most seriously, (3) using the rename function on an attached file causes the attachment link to break, so that the renamed file has to be relocated manually. So, for the moment, I think I will stick with Joscha's plugin.
  • Hi Keith,
    The remane function of Zotero is somewhat configurable. At present you are able to select: Author, Year and Title
    You'll find more options here:
    http://forums.zotero.org/discussion/2160/is-there-any-automatic-renaming/ and
    It seems, that if you ask for a criteria in the second link, it might be included in a newer version.
  • you can - to be quite specific - switch from dashes to underscores and no spaces by changing
    '{%c - }{%y - }{%t{50}}'
    in the hidden pref in about:config

    but the attachment issue I understand - I never use links so I wasn't aware of that.
  • trala-la and adamsmith: Thanks for your replies. I didn't know about the config options, so thanks for that. I guess it's just the link-breaking that is holding me back now. I notice that it's been reported before by trevory -- see http://forums.zotero.org/discussion/7809/20b62-rename-file-from-parent-metadata-cant-find-file/. I guess it should be easy to fix.
  • Thanks Dan! Will that be in the next update?
  • Dear Joscha,
    thanks for this great tool. I have one problem: zotfile deletes existing pdfs not only when I add a second pdf to an existing item, but also, when I add a pdf to an item that has the same renaming name as an existing item. This is currently the case with two items that I have where a book comes in two volumes. Author, year and title of the book are the same. Only the subtitle is different (this is not very unusual, thing of collected works of authors. What happens now is when I add a pdf with zotfile to both items, zotfile deletes the first, since it has the same name that zotfile is giving. It would be nice if zotfile could somehow detect that these are two different items and attach both of them.
  • Hi all,

    I fixed the disappearing icon, I think. I sent the fixed version to Joscha, so hopefully you'll hear more of him soon.
  • Hi,
    here is a new version:


    It includes two improvements:

    1) Instead of overwriting existing files with the same name, Zotfile adds an index starting at 2 to the filename if the file already exists in the destination folder. This allows you to add more than one attachment to a zotero item with zotfile and solves the problem described by migugg.

    2) Thanks to RoelofOomen, the bug with the disappearing icon was fixed.

    Sorry Keith, no editor name for books so far...
  • Zotero 2.0b7 has an Attach menu, using the same icon as Zotfile. If anyone has an idea for a new (small, clear) Zotfile icon, please tell.
  • I just upgraded to 1.0.5 and zotero 2.0b7 on windows. The zotfile import no longer imports my pdf (files remain in import folder). However, it does seem to "try" to run, because I get a zotfile message when I try something illegal (such as importing into a snapshot).

    Any special things I should do regarding the upgrade?

    Any suggestions how to debug?
  • Actually, I have more or less the same problem, but as no comments showed up here I thought it was something I messed up myself.
    Let's see if Joscha has a solution, and otherwise I might look into it next week.
  • I am having problem too. In my case, however, zotfile usually works the first couple of times after starting firefox (often only once or twice) and then stops doing anything (despite the error message for doing something 'illegal'). Do you have the same experience? It makes it slightly more difficult to pin the error down because everything seems to work fine after restarting firefox (which I have to do when install a modified zotfile version). I will look into it and see what I can do in the next couple of days..

    Icon: Any thought on adding zotfile to the new attachment menu and removing the separate icon (which would require two clicks to start zotfile)?
This discussion has been closed.