Lost about all file locations

edited 23 days ago
Hey guys, hope you're doing well.
So I was a longtime ZotFile user because I store all my PDFs in my Google Drive.When I got to the 7.0 beta (I'm now at 7.0.0-beta.107+2917f41cb), I migrated to ZotMov and it uses a different filepath than ZotFile used to.
No problem here...Until I tried to apply ZotMov's paths to all files.
I don't know if an error occurred or what, but, long story short, now I have no idea which files have their correct path and which don't.Good news is that 1) Apparently the PDF names remain the same, 2) all PDFs are inside a specific folder (either on the folder itself or in a subfolder).

188BET靠谱吗https://s3.amazonaws.com/zotero.org/images/forums/u4028532/sqotu43sh057m8xdanpy.png

Here's what I'm planning to do:
1) Get all the PDFs from the subfolders to the root folder
188BET靠谱吗2) Alter Zotero's database to only contain the path to the folder, kinda like this:
oldpath = Documents/author/subfolder/whatever/file.pdf
newpath = Documents/file.pdf

For 1 I intend to use python to crawl to all subfolders and, if filetype="pdf", move it to newpath.
For 2 I have no experience with sqlite, could you guys point me in a general direction as to how to do this?188BET靠谱吗Like, is it as easy as opening zotero.sqlite and using some command to batch alter some variable like itemAttachmentFilepath?
  • edited 23 days ago
    I figured it out:
    1.188BET靠谱吗You can use python's sqlite3 to access Zotero's database
    2.on the table itemAttachments, you access row[5] and change oldpath to newpath.

    commit...
    close...
  • Especially If you use syncing (but also more generally), modifying the sqlite like this is very likely to break things left and right.
  • (Aside from being a very bad idea, it was also likely unnecessary.188BET靠谱吗Zotero itself will correct most incorrectly set paths just by choosing a Linked Attachment Base Directory that contains the files and trying to open one of them.)
  • edited 22 days ago
    188BET靠谱吗As Zotero 7 is still in beta, the instructions on how best to migrate a linked attachment file setup from v6 to v7 (changing from Zotfile to zotmoov or attanger) have not really been discussed in any detail around here.188BET靠谱吗But that should happen when Zotero v7 is finally released.The transition should be straightforward for most people.But it might not be for more complex existing linked file setups.

    Changing from Zotfile to Zotmoov would only change where *new* linked files that you download from now on get *stored* ...*if* you set those plugins' linked file folder locations differently.But neither plugin itself has any effect on the stored locations of *existing* linked attachment files.

    188BET靠谱吗So neither Zotfile nor Zotmoov affect where Zotero *looks* for linked files when you ask it to open them.That is determined by the location stored in the 'path' field in the itemAttachments table, which you found.188BET靠谱吗If you do not have a Linked Attachments Base Directory set, the linked file paths stored there will be explicit, eg D:\ZoteroAttachments\filenameXYZ.pdf.188BET靠谱吗If you do have a LABD setting (eg D:\ZoteroAttachments), the file path will be stored with an 'attachments:' prefix (eg attachments:filenameXYZ.pdf) [note that any attachment files in *local* Zotero storage will have a 'storage:' prefix instead].188BET靠谱吗The 'attachments:' prefix tells Zotero to insert the LABD location in place of the prefix when you ask it to open the PDF.188BET靠谱吗If Zotero cannot find the linked file at that path when you try to open it, Zotero will tell you where it was looking in the error message (which is often the clue to where things are going wrong).

    [Edit: the zotmoov dev has just updated the instructions to remove the default instuction to set a LABD referred to below - it is now only mentioned in the correct context]
    The current instructions for Zotmoov seemingly unnecessarily suggest setting the Linked Attachment Base Directory as the first step in its use.188BET靠谱吗That setting should be irrelevant to Zotmoov, as the LABD only affects where Zotero *looks* for linked files, not where they get stored (which is what Zotmoov does).
    https://github.com/wileyyugioh/zotmoov

    Re "I migrated to ZotMov and it uses a different filepath than ZotFile used to", I am not sure what you mean by that.It will only use a different filepath (for storing new linked files) if you told it to do that.

    188BET靠谱吗The best solution to your problem will depend on whether you already have a LABD setting (all along, or only now because Zotmoov suggested you set the LABD), and also any *real* difference in the actual linked file paths you had in Zotero v6 (with Zotfile) and those you have now in Zotero v7 (eg if you have moved any linked files in your OS).
Sign Inor Registerto comment.