Mass change of paths to data

Hi,
I have a problem. I had all my electronic articles and books in a folder "D:\Books" and its subfolders and all paths to them from Zotero were to this location. Recently I migrated from Windows to Linux. Of course, there's a different file system, so now the paths should be in my case as follows: "/media/hdb1/Books"

Well, I have more than 900 items in Zotero and I want to know if there's a way, how to relatively easily change all the paths from "D:\Books" to "/media/hdb1/Books"? I'm really scared of manually editing all the 900+ items to lead to the new location.

Greetings
Alexandr
  • Hi,
    I'm having a similar problem migrating from Windows to OSX. I'm assuming the sqllite db could be manually edited with a search and replace but if there is an easier way to get this done I'd prefer not to get my hands dirty.
    Did you find a way to do this Alexandr?
    G.
  • Hi,
    unfortunately I haven't been able to solve the problem.
    Greetings
    Alexandr
  • The only way to do this from Win to Linux currently would be with the SQLite command-line client. You'd want to update the paths in the itemAttachments table and use the SQLite SUBSTR() command to replace the beginning of the path.

    Going from Windows to OS X is more complicated, as OS X doesn't use string paths for files. One way to do this would be to write some JavaScript that ran within Firefox and converted the Win/Linux-style file paths in the DB to the non-human-editable "persistent descriptors" used on OS X.

    Alternatively Zotero could just always use a string path. Despite Mozilla's warnings not to use string paths, I think only on OS 9 could the same path potentially point to different files, since volumes could be named the same—on OS X additional drives/partitions just show up under /Volumes with a unique name. I'll look into this and consider making that switch, as that would allow a lot more flexibility (shell scripts to change paths, etc.) when switching between computers of different platforms.

    Note that items stored within the Zotero data directory—snapshots and files attached using "Store Copy of File"—should work cross-platform automatically.
  • Thanks Dan, having not read your post I tried to do this last week and encountered the 'persistent descriptors' issue. I think in the process I did use strings on OS X and while it linked to the files okay, they didn't seem to be linked to the original item stored in Zotero anymore, the pdf became a separate item. But that could have just been something that I broke when editing the db. I guess I'll use the 'store copy of file' option from now on.

    I've also been using rCache to extract text versions of the pdf's as I imagine that'll give me more flexibility when searching through all of my attachments, it'd be great to see this functionality integrated into Zotero.

    Thanks for yr work on this, much appreciated.
  • I've also been using rCache to extract text versions of the pdf's as I imagine that'll give me more flexibility when searching through all of my attachments, it'd be great to see this functionality integrated into Zotero.
    http://www.zotero.org/documentation/pdf_fulltext_indexing

    There'll be an interface for setting up PDF indexing in the next release.
  • Hi,
    thank you very much Dan. I have looked at it. The SUBSTR() function isn't very useful for me, because I have many subdirectories in the "D:\Books\" directory, so I have to substitute all the backslashes for slashes ("\" for "/"). I tried to use the REPLACE() function mentioned in the sqlite documentation, but it said: "no such function: replace".
    Have you any other advices for me?
    Thank you in advance.

    Alexandr
  • You're probably using an outdated version of SQLite that didn't support REPLACE().
Sign In or Register to comment.