Re-attach files in links

Hello,

I am looking for a way to re-attach links to items in my Zotero collections. For example, I have an item in the library called "Test". Within Test is an attachment called Test_file.pdf. All of my attachments (including Test_file.pdf) are in a base directory, which I have specified in the Files and Folders section of Zotero' Preferences. It appears that just having the file in the right place and having an attachment with the identical file name is not enough for the attachment file to be linked to the Zotero library entry. That is, when I click on the attachment from the library, I still receive the prompt to locate the file. As soon as I help Zotero re-locate the file then it of course opens just fine.

Is there a way to have Zotero look right where I'm telling it to for the attachments and compare against the filenames listed for the Attachment file and re-attach in an automated way? I have about 400 entries like this.

Thanks
  • Update here: I think i found the issue. The existing links, which I would like to re-attach to the attachments, were generated using absolute paths. I can see that in the right column when I select the attachment from the middle column. This of course doesn't solve my problem; it just might narrow the focus for the problem solving.

    So the question becomes, how do I have Zotero change the filenames of each of these 400 links to be \relative_base_directory\existing_filename.pdf from what it is now as c:\absolute_directory\existing_filename.pdf ?

    Thanks.
  • The files need to exist at the absolute paths Zotero knows about. You can then set the relative base directory to c:\absolute_directory, which will change the paths to be relative from that directory. After that, you can then move the base directory wherever you want and update the base directory accordingly.

    Alternatively, I believe Zutilo, a third-party plugin, can modify absolute paths directly in batch.
  • Actually, correction: the files don't actually even need to exist at their specified absolute paths. You just need to set the base directory to that absolute path, which essentially collects those files as relative paths. You can then set the base directory to reflect the actual location of the files, as long as the relative path is the same.

    So, e.g., if you have a file with a path set to c:\foo1\bar.pdf, but the file exists at c:\foo2\bar.pdf, you can set c:\foo1\ as the base directory, which will change the path to the relative path "bar.pdf". If you then change the base directory to c:\foo2, the file will be found.
  • Thanks. Zutilo ended up working out very well for me. Except...I have one more strange thing going on. Some of the attachments have no easily identifiable path. When I use Zutilo to show the attachment path all it shows is the filename. Usually if there is some path then I will see "attachments:filename.pdf" or before I learned the attachments: trick it would say "c:\users\...\filename.pdf". Now it only says "filename.pdf".

    As a result of this null-path scenario. I cannot provide an "old" path, which is the first step of changing the path using Zutilo. I've tried leaving it blank, but then it just exits and doesn't ask for a new path. I've also tried the usual old-path suspects ("attachments:" "\" "/" "c:\users\...\"), which at least gets me to the second dialog box where I enter the new path, but the new path never takes over.

    This issue applies only to a sub-set of the library, because I accidentally removed any path using this same Zutilo path change tool (before I knew what I was doing).

    Any ideas?

    The 2nd approach you provided in your 2nd post didn't seem to help with this.
  • One last thing...I used debug output mode to determine where it was looking when I tried unsuccessfully to open an attachment. It appears to be looking at a Zotero storage location from my previous PC. This is of course a folder that doesn't exist on my new computer. That's also why when I put this folder from my old PC as the "old" path when changing the path through Zutilo that it doesn't register.
  • edited June 27, 2016
    Sorry, you'll have to ask the author of Zutilo for help using that tool.
  • edited June 28, 2016
    Thanks so much for your help.
Sign In or Register to comment.