ZotFile - Advanced PDF management for Zotero

  • Okay, strike out question 1. I just modified "/%y /%w" to "/%y\/%w" (Windows OS) and I got the nested subfolder that I wanted!
  • 2) the watch folder only adds newly added files to Zotero and it only adds them as independent items when you don't have an item selected in the middle panel (e.g. after selecting a collection on the left).
    (not that you can, obviously, just drag all or files into Zotero if you want to add them, no need for a watch folder for that purpose).
  • @adamsmith:

    "just drag all or files into Zotero if you want to add them"
    That is what I ultimately did. And for new references, I now either directly save the PDFs to Zotero or save references to the library and the PDFs get downloaded automatically if I have access.

    So I do not really need the Watch functionality particularly anymore. My question stemmed mainly from curiosity as I could not get the Watch functionality to work.

    I tried adding files to the Watch folder in the following scenarios before posting my question earlier on:
    a) With Firefox and Zotero for Firefox closed.
    b) With both of them open and having selected an item in one case and
    c) A collection in the other.

    Neither of the cases yielded any dividends. Nothing was added to Zotero. What do you mean by "newly added files", exactly? Files that have been newly added to the watch folder or files that have been freshly created in the system (such as by downloading)?

    Lastly, as a newbie to Zotero and Zotfile, I was confused about what happens to files that are added to Zotero (as copies or as links) and then renamed using Zotfile and where they are stored ultimately.

    Having experimented with all the possible combinations of settings, I summarised and tabulated where the attachments ultimately end up. I think that this table I ended up with would also help other new users who find themselves in my position. Can you direct me as to where I can post it?
  • Re: table -- you can create a new post on the forums summarizing it. You can also e-mail it to Joscha, the zotfile developer. He might be interested in including it in his documentation, but don't be offended if he decides not to.

    As for the watch folder, all of that should have worked, hard to say why it didn't. It's about files added to the watchfolder, so either downloading them or moving them there should have worked.
  • @adamsmith: Thanks!
  • @ boegh, @ Joscha

    I am not sure how feasible it is, but in general I would vote with boegh. It would be great to have options for the format of the extracted cite link, depending on one's workflow.

    Jump-to-page is a great feature, but I find that I consult the source pdf less frequently then re-format the references for each cite. I am aiming at just extracting the notes and putting them straight into the right places in my outline (and then checking pages for just the ones that I'll end up actually using). In this scenario, I would prefer zotfile links to be the plain-text scannable citations.

    And I am not alone; here is a thread with more people trying to do something in this direction: https://forums.zotero.org/discussion/27826/extraction-format-of-zotfile/. And it would be just fantastic for many people who write in Scrivener or other dedicated writing programs that outputs rtf.

    Would it be something very difficult to implement?
  • Here is a ticket for that: https://github.com/jlegewie/zotfile/issues/175
    I added your suggestion about scannable citations. Shouldn't be too hard but I wont get to it anytime soon. Happy to make suggestions when someone wants to try it though.
  • Thanks, looking forward to it! It would be useful to many people who use the rdf plugin.
    So far, I am just generating a scannable cite with zotero and then inserting it with search/replace.

    Another suggestion for a maybe/later: so far zotfile just generates one report per file, and it does not do anything special if there are a few new comments as compared to the previously extracted file. It seems to be difficult to do more "intelligent" extraction.
    While it is a dirty hack, perhaps it would be possible to scan previous report for the generated links and insert only those highlights in the new report that are on different pages?
  • @Joscha

    Trouble with plugin: some (heavily annotated) pdfs won't have their annotations extracted! The extraction starts, but then nothing happens.
    Here is a sample file with this problem: https://www.dropbox.com/s/p0n3xw5hr3i8c93/ch4-1.pdf?dl=0
    Annotations were made in PDF X-change viewer.
  • Works for me without a problem. Are you using the most recent version and pdf.js for extraction? Otherwise you can try the version on github. There was a small change that I did not commit previously. Maybe that solves the problem. Otherwise I can't really help because it's working for me.

    Here are part of the annotations:

    Extracted Annotations (5/29/2015, 8:19:13 AM)

    "4" (Aaronson et al 2007:95)

    "consistency, or the extent to which the same subject gives a sentence the same rating on different occasions, or different subjects give a sentence the same rating. In the former case, inconsis­ tencies are liable to be the result of factors having nothing to do with subjects' linguistic representations, e.g., whether they are fresh or fatigued, uncooperative, attentive or distracted, etc. (Bradac et al. 1980). In the latter case, interspeaker differences might be attributable to differences in deeper properties of the minds of the people in question, in their grammars or in some other module that affects grammaticality judgments." (Aaronson et al 2007:95)
  • @Ookimi: Extracted the annotations from your pdf without difficulty. (The last one ends with this: "the effect of one dimension on grammaticality depended on the level of the other." ( :10)")
    Mac, FF38.01, Zotero 4.027beta, Zotfile 4.1.5
  • edited June 4, 2015
    I have recently switched from having my PDF files saved to Zotero’s data directory and synced by Zotero. I used Zotfile to transfer all my PDF files to a new custom location of files by renaming all of my attachments.

    My question is this: Is it possible to nest subfolders in the folder defined in Zotfile? Can the “Use subfolder defined by?” feature be used to create folders that parallel the collections and subcollections I have on Zotero?

    For example:
    In my Zotero library, I have the following collections:

    Collection 1 > Subcollection 1 > PDFs
    Collection 1 > Subcollection 2 > PDFs
    Collection 1 > Subcollection 3 > PDFs

    At the moment I am setting the “Use subfolder defined by?” to “%c”. This means in the folder defined in Zotfile I have the following sub-folders:

    Collection 1Subcollection1 > PDFs
    Collection 1Subcollection2 > PDFs
    Collection 1Subcollection3 > PDFs

    However I would like to nest the subcollection into a further subfolder, ideally like this:
    Collection 1 > Subcollection1 > PDFs
    Collection 1 > Subcollection2 > PDFs
    Collection 1 > Subcollection3 > PDFs

    Is this at all possible? I’ve read the wildcards on zotfile.com and searched many different forums to try and find a solution but it has continued to evade me. Apologies for any lack of clarity and thanks in advance for your assistance.
  • I have a question: when/why does Zotfile change a PDF to "attach link to file?"
    I am finding that sometimes when Zotfile renames a pdf (either when downloading via firefox icon or when "forced"/right-click to rename), the pdf icon is given the "link to file" icon. However, I can't seem to figure out the reason. Is it a bug? Or am I just missing something? Thank you.
  • ZotFile links files when you have it set to move files to a custom location under "Location of Files" in the General Settings tab of the preferences.

    @AlexHunt haven't tested, but you can try experimenting with escaped slashes (\/) as per Vijayanth's 2nd post from May 5th.
  • Sorry to be late to responding to my earlier problem of 3/25, but I wanted to confirm that the advice you gave kynan on 4/30 was also the source of my problem. The _tablet tag was saved on the PDF attachments. Deleting the tag on both the parent file and the PDF solved the problem.
  • @adamsmith thank you for the reply, however before trying to experiment with escaped slashes I need to identify wildcards that specify "Collection" and "Subcollection".

    With the escaped slashes, using the wildcard “%c”, the best that could be achieved at the moment is:

    Collection 1Subcollection1 > Collection 1Subcollection1 > PDFs
    Collection 1Subcollection2 > Collection 1Subcollection2 > PDFs
    Collection 1Subcollection3 > Collection 1Subcollection3 > PDFs

    Whereas I am looking to perform the following nesting:

    Collection 1 > Subcollection1 > PDFs
    Collection 1 > Subcollection2 > PDFs
    Collection 1 > Subcollection3 > PDFs

    Therefore I need wildcards for "Collection" and "Subcollection" however I'm not sure they exist.
  • Hi,

    I have previously installed ZotFile. Totally made a mess of it. Uninstalled the plugin and removed the files I copied to my tablet.

    Months later I tried using the plugin again and succeeded in getting the process to work the way I hoped.

    I have however encountered a problem. All the PDFs I deleted originally still appear in ZotFile's tag list of files copied to the tablet and everytime I enter this smart search collection it throws up an series of errors about the files being missing.

    What is the best way to resolve this problem?

    Thanks Simon
  • What steps exactly are you taking to trigger the errors and what errors exactly are you getting?
  • If I select the "Tablet Files" or "Tablet Files (modified)" saved search collections to see what files are currently on my tablet I have an error

    Zot File
    The file "/local/sync/dir/missing.pdf" does not exist.

    appears for each of the many files now not present in the 'tablet' directory.
  • edited June 14, 2015
    OK, It appears as if these lists are controlled by tags. Removing _tablet and _tablet_modified from ALL items and attachments on the list remove them from the saved search listings.

    What confused me initially was removing _tablet did not seem to do anything -- i.e. the references still appeared in the Tablet Saved Search so I thought something else was going on. I did not realise that the attachment had an additional tag _tablet_modified. Note the first part is the same so the parent would appear in both saved searches. Doh!
  • I have never been able to get the pdf automatically downloaded from SSRN through Zotero Standalone + Zotfile + Chrome (all latest versions) - even when I am logged into SSRN.

    Is this currently not supported or am I just not doing things right?
  • @paulma -- auto-PDF import has nothing to do with ZotFile (Zotero does that by itself) but to answer your questions: no, SSRN PDF import isn't supported, SSRN really doesn't like software grabbing PDFs directly and because of that, even to the extent that it might be possible (which wouldn't be trivial), we probably shouldn't do it.
  • Hello,
    I'd like to rename my attachments with this specific rule : use the full date (dd/mm/yyyy) if the parent item is a case, otherwise display the year (yyyy).

    I tried : "2": {"default": "%y", "case": "dateDecided"}
    but it seems that "year" (%y) is not directly available for user defined wildcards.

    (and btw, "dateDecided" returns the exact, raw, content of the field, i.e. the date is not parsed, which can be a problem when the user has entered the dates in different ways. I assume there's nothing to do?)
  • edited June 20, 2015
    Hi, Joscha!

    Thank you for the great plugin! I really like it. Especially I
    like '%c' wildcard, which allows me to order and then reorder my
    library conveniently from Zotero interface. Unfortunately, it
    doesn't work smoothly in case of multiple files attached to a
    single Zotero item.

    Consider the following example. Imagine we store attachments in
    subfolders defined as '/%c/{%a-}%t' and renaming format defined
    as '%t'.

    A book item has a number of attachments:
    + cover.jpg
    + book.pdf
    + examples.zip
    + appendix.pdf
    + errata.pdf
    + notes.org

    After moving the item to a different collection and renaming
    attachments with ZotFile I will get a mess like that:
    + book-title.jpg
    + book-title.pdf
    + book-title.zip
    + book-title2.pdf
    + book-title3.pdf
    + book-title.org
    though I just want to move all the files to a different place.

    So, here is my question. Is it possible to implement a wildcard
    that evaluates to the current attachment filename? Or is there
    another way to tell ZotFile not to change filenames but to change
    attachments directories only?

    Best Regards,

    This may be a challenging problem. I've been using Zotfile for about a week without any problems. Yesterday I started getting error messages like the following whenever I try to Rename Attachments:

    Zotfile Error

    Error when moving the file 'Ch1.pdf' ([Exception ... "component returned failure code: 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED) [nslLocalFile.MoveTo]" nsresult: "0x80520015 (NS_ERROR_FILE_ACCESS_DENIED)"
    location: "JS frame:: chrome://zotfile/content/zotfile.js :: Zotero.zotfile.moveFile
    Here are some details and complications.

    1. My configuration stores the attachments at a custom location, namely a NAS drive at my home connected by WebDAV via HTTPS to my laptop (a MacBook) and to the computer in my office (an iMac). It's also connected at home via the local network connection using AFP (Apple Filer Protocol) to my home computer, also an iMac. All three computers run OS X 10.10.3 (Yosemite). I am also running Zotero in Firefox, Zotero as Standalone, Zotfile 4.1, and Firefox 38.0.5 on all 3 computers.

    2. Sometimes the error code and message vary. For example I'm currently getting 0x80004005 (NS_ERROR_FAILURE) on my office computer but 0x80520015 at home. (Sorry if some of the error messages are not quoted exactly verbatim. The message stays on the screen for only a few seconds.)

    3. As of this morning when I tested the three computers, the laptop worked fine. The home computer threw the 0x80520015 error, and the office computer threw 0x80004005.

    4. After clearing, FireFox's Error Console gives five warnings: "Warning: TypeError: setting a property that has only a getter." Then it gives an informative message: "OpenGL compositor Initialized Successfully ... "

    The only thing unusual recently is that I was using the laptop on a train. I underestimated how long it would take to move a file from my local drive to the NAS drive at home. So I started a move (Rename Attachments), but the train arrived at my destination before the move finished, and I had to close the laptop. I had to just hope that the WebDAV implementation and ZotFile did not destroy or permanently alter anything until and unless the copying operation completed.

    Still, as I understand things, both error messages pertain only to local files. So access to copied files on the server is not causing these problems.

  • File Access Errors are pretty much never Zotero/add-on bugs.
    This is something very specific, either caused by the interrupted transfer or by access errors caused by your setup.

    Can you identify the file this refers to or do you have a ton of those Ch1.pdf files? If so, try to work with that.
  • Yes, I can easily identify the file. I deliberately moved about 20 files into a single directory and linked from there.

    But how should I work with it? I can easily open, copy, move, etc. the file. Looking at it with "Get Info" in the OS X Finder shows it belongs to me & I have rw permission. In short, I don't see anything wrong with it.

    Moreover, I'm having errors like this on two different computers, attaching two entirely different files, and the only time I run into trouble is when I use Zotfile to rename the file and move it to the library on the NAS drive. This makes me think the problem is not with the original files themselves.
  • Have you tried specifying a different, non-NAS directory as the target and see if that makes a difference?

    And where are the files currently? That's a bit confusing to me -- I'd expect them to be in zotero/storage, but then you write you moved them to a single folder?
  • @Josch

    A couple of naïve questions about pdf extraction (pdf.js on WIndows 8):

    1) when notes are extracted, I am left with ugly double line breaks between lines. I am using Pdf x-change viewer to make the notes; is it program-related, or is it a general problem with zotfile?

    2) zotfile recognizes standalone notes, but not notes added to highlights. This would be a very, very, very useful feature... The best metro-style pdf reader tht I can use on my tablet is the Microsoft one, and it cannot add standlone notes. Moreover, it does make sense research-wise to associate your comments (typed in a note) with a particular quotation (which is highlighted).
  • Regarding adamsmith's comment & question.

    1. These are pdf's I'm adding to Zotero. So initially they're stored completely outside of Zotero. Some are on the hard drive of my computer; others are on a departmental server. Using Zotfile, I am adding them to Zotero in two steps. (1) "Add Attachment > Attach Link to File" > (navigate to pdf file and select it). (2) "Manage Attachments > Rename Attachments." The problem occurs in the second step.

    2. I just performed an experiment. First I changed the Custom Location for the pdf files. I changed it from being on my server to being on the hard drive of my computer. I then "Renamed Attachments" for one item, and the pdf associated with it moved to the Custom Location on my hard drive. Next, I changed the Custom Location back to the NAS drive connected via WebDAV. I "Renamed Attachments" again and for the same item. This time Zotfile did its magic. I used Finder to navigate to the NAS drive, and sure enough Zotero created a folder containing the pdf and put the pdf in it.

    So now the questions are, "What can possibly be causing this curious behavior? And, how can we fix it or work around it?"
This discussion has been closed.