I didn't get a chance to try the script because the symlink method worked -- genius.
Even after a restart, which ejected the fake GoogleDrive disk image, the file links now point to the right place. Thank you! On Wed, Feb 8, 2023 at 10:43 AM Christiaan Hofman <cmhof...@gmail.com> wrote: > I thought of perhaps an easier way to fix your problem using > AppleScript.There is a trick to get the relative path in AppleScript even > in the linked file is broken. Here is a script that you could use to fix > the links. Run it from Script Editor. > > *property* oldPathPrefix : "../../../../../../Volumes/GoogleDrive/" > *property* newPathPrefix : "../../GoogleDrive-USERNAME/" > > *tell* *document* 1 *of* *application* "BibDesk" > *set* theBibFile *to* *its* *file* > *set* theIndex *to* 1 + (length *of* oldPathPrefix) > *set* thePubs *to* *its* selection > *repeat* *with* aPub *in* thePubs > *set* thePub *to* contents *of* thePub > *if* (*count* *of* *linked files* *of* thePub) > 0 *and* *linked file* 1 > *of* thePub *is* *missing value* *then* > *try* > *set* relPath *to* *export* using text > "<$publications.@firstObject.localFiles.@firstObject.relativePath/>" for { > thePub} > *if* relPath *starts with* oldPathPrefix *then* > *set* relPath *to* newPathPrefix & (*text* theIndex *thru* *end* *of* > relPath) > *set* theFile *to* *resolve* relPath relative to theBibFile > *set* theFile *to* theFile *as* *alias* > *tell* thePub > *remove* *linked file* 1 > *add* theFile > *end* *tell* > *end* *if* > *end* *try* > *end* *if* > *end* *repeat* > *end* *tell* > > > Of course you should replace the correct new path prefix (i.e. fill in > USERNAME). The script works on the selected publications (from the main > table). I would suggest to try it first on a single selected item, to see > it works correctly. I have not tried out the script, as I don’t havenything > to try it on. > > Christiaan > > On 8 Feb 2023, at 00:09, Christiaan Hofman <cmhof...@gmail.com> wrote: > > > > On 7 Feb 2023, at 21:52, Laurel MacKenzie <laurel.macken...@nyu.edu> > wrote: > > I have Bibdesk auto-file my PDFs in a folder on a mounted Google Drive > volume, so that I can access them from anywhere. Without warning, Google > Drive has changed the way it mounts on a Mac, breaking all my file links. > > Previously, files were saved at the following path: > ../../../../../../Volumes/GoogleDrive/My Drive/Books & > papers/FILENAME.pdf > (This is based on my decoding the bdsk-file-N field of entries added > before the migration) > > I've changed the autofile location in Bibdesk preferences so that > newly-added PDFs go to the right place. Now, files are saved at this path: > ../../GoogleDrive-USERNAME/My Drive/Books & papers/FILENAME.pdf > (This is based on my decoding the bdsk-file-N field of entries added after > the migration) > > But the 3000 PDFs I added before Google Drive migrated itself are all > showing up as broken links in Bibdesk. Is there any way to fix them? > > Thanks, > Laurel > > _______________________________________________ > Bibdesk-users mailing list > Bibdesk-users@lists.sourceforge.net > > https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.sourceforge.net_lists_listinfo_bibdesk-2Dusers&d=DwICAg&c=slrrB7dE8n7gBJbeO0g-IQ&r=x2RvmHoTb___X9Qv6mqKIeS8QHlEg_emQRr5vk5PL_0&m=sE9jyUEEQ-oopBUXfh0rbtLKyFEVjTGzgnpyPJxAqCABCpJazZEUr0fFSahiojPL&s=5tV8ItBciZ6k3WvP8uCRBK523oqJL4MhUNbMwiHPeTk&e= > -- Dr. Laurel MacKenzie | Assistant Professor Department of Linguistics | New York University www.laurelmackenzie.com
_______________________________________________ Bibdesk-users mailing list Bibdesk-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-users