Migrate Mendeley library and keep the file references

The following small guide helps to migrate the Mendeley library and the file paths of the linked PDFs. If you have a Mendeley account and all your synched files combined are not exceeding the space limit, then the files are synched through the Mendeley service.

If your collection became quite large, then you can copy the database file between the two computers. The problem however is, that in the database the paths to the files (mainly PDFs) are stored as absolute paths, which are not necessairly the same between the two machines, hence the links to the files are not working anymore.

The following guide shows how to replace the paths inside the Mendeley database. (This guide assumes that all the literature files are stored inside one folder)

 

1. Installation of Mendeley and SQLite Database Browser

Download and install Mendeley desktop and the SQLite Database Browser, to edit the Mendeley database file, to your second computer, where you want to migrate Mendeley.

 Mendeley desktop  SQLite Browser

 

2. Copy the database and the folder storing all the literature files

Copy your Mendeley Desktop database file on your first computer to the second computer. On Windows machines it is located inside the user folder in AppData\Local\Mendeley Ltd\Mendeley Desktop looking like this: <youremail@provider.com>@www.mendeley.com.sqlite (see: Article: Locate mendeley database).

Copy the folder storing all the literature (all PDF files etc) from your first computer to the second computer. In our example the literature of the first computer is stored in C:/Users/John/Documents/Mendeley/ and of the second computer the files will be stored in C:/Users/John/Documents/Literature/.

 

3. Edit the SQLite Database to store the new file paths

Open the <youremail@provider.com>@www.mendeley.com.sqlite database with the SQLite Browser.The paths to the files are stored in the table „files“ (see Fig. 1).

mendeleySQLiteFiles
Figure 1. Files table of the Mendeley database

 

These old paths (old: file:///C:/Users/John/Documents/Mendeley/) need to be changed to the new location of the literature folder (new: file:///C:/Users/John/Documents/Literatuere/) with the following SQL query. This query replaces the string of the old path with the new one. After execution of the query, saving the SQLite database and restarting Mendeley Desktop the files should link correctly again (see Fig 2).

update Files set
localUrl = replace(localUrl, 'file:///C:/Users/John/Documents/Mendeley/', 'file:///C:/Users/John/Documents/Literature/')
where
localUrl like 'file:///C:/Users/John/Documents/Mendeley/';
mendeleySQLiteFiles2
Figure 2. Execute SQL query to change the paths of the Literature files

9 thoughts on “Migrate Mendeley library and keep the file references

  1. Thank you very much for your post. I have used mendeley successfully in several computers by storing my references and database files in a Dropbox Folder synced across the multiple devices. The file path for all computer is the same (e.g., C:Dropbox/Mendeley). Recently Mendeley was crashing in all computers. I migrated the DB file to Google Drive and pointed Mendeley to look for it in the new location, which now allows me to use Mendeley. However, my references are still in dropbox.

    I tried using your method to update the SQL file to be able to move my references to Google Drive. Unfortunately, I cannot get it to work. I will not update any of the registries.

    The following are the results:

    Query executed successfully: update Files set
    localUrl = replace(localUrl, ‚file:///C:/Dropbox/NCSU/Publications/‘, ‚file:///C:/GoogleDrive/NCSU/Publications/‘)
    where
    localUrl like ‚file:///C:/Dropbox/NCSU/Publications/‘ (took 0ms, 0 rows affected)

    Can you provide some assistance?

  2. thanks a lot for this information, it was very helpful. Although I needed to tweak the script to make it work.

    I used the following:

    update Files set
    localUrl = replace(‚file:///C:/Users/jordi/Documents/biblio/‘, ‚C:/Users/jordi.Therminus15‘, ‚home/jordi‘);

  3. the correct script in prvious message should be:

    update Files set
    localUrl = replace(localUrl, ‚C:/Users/jordi/Documents/biblio/‘, ‚home/jordi/Documents/biblio/‘);

  4. Thanks a lot for this! It just saved me a lot of trouble after renaming a parent folder of my Mendeley library (god forbid!). Note: I was using the modification suggested by jordi.
    I’m getting really fed up with Mendeley lately, I’m dreaming of migrating to a different manager but am kind of locked in for the time being.

  5. Hi Guys,

    thanks a lot for your help. I had some troubles as there was a space in my new directory. The following command worked for me after some trial and error:

    update Files set
    localUrl = replace(localUrl, ‚file:///D:/Users/maleseal/Documents/Literature/‘, ‚file:///D:/Users/maleseal/OneDrive%20-%20Danone/My%20Documents/Literature/‘);

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.