Move folder with PDFs and have JabRef reconnect links to them automatically

Hi there,

As is written in the subject, is there a possibility to move a folder (while keeping its structure intact and/or different) with my PDFs and have JabRef reconnect links to them automatically after the fact?

For example, move

\level 1\level 2\PDFs\
to
\level1\PDFs\
or to
\newfolder\newsubfolder\PDFs\

and suffer no consequences?

I would’ve tried on my own, but I’m afraid to mess up with the database and then not being able to go back. Yes, I know I can create a copy of it, but still it’s better to ask.

HI,

welcome to the wonderful magic fature of JabRef, renaming and moving files :wink:
It’s definitely advisable to create a copy of your bib file.

JabRef can rename files, create directories and move files to those directories, it’s very flexible, but depends on how you organize your files.

  1. Do you have a sinlge folder where you put alll your pdf?
    Then it’s probaly simple. Just change the main file directory in the preferences to the new one and to a Cleanup -> move files to folder. Then JabRef should move the files to the folder.

Before you do this for all files using the Cleanup operation it’s advisable to test it with a single entry first.
Right click the file in the gernal tab -> Move

Hi Cristoph and thanks for your reply.

My organization is like this: I have a main folder which doesn’t contain any PDFs, but only the folder structure (organized thematically). The PDFs are located down in the subfolders, at multiple levels.

Finally, all PDFs are named according to my own naming scheme (i.e. Author - Title . Subtitle [year].pdf) that I’d like to keep.

Is there a possibility I move somewhere else the whole main folder with the structure and naming as they are now, and then just make JabRef relink them as they were?

I guess the alternative would be to replace the path string inside the .bib file for each entry, which I would avoid doing unless absolutely necessary.

Each users organizes the files slightly different. If you have the file paths stored relatively in the .bib file, this is no issue. If not, you can use the cleanup action to convert the paths to relative ones (see https://docs.jabref.org/finding-sorting-and-cleaning-entries/cleanupentries).

Then you can use the preferences of the current library to change the starting search path: https://docs.jabref.org/faqgeneral#q-how-do-i-link-external-files-with-paths-relative-to-my-bib-file-so-i-can-move-my-library-along-with-its-files-to-another-directory

Then, it should be no issue to move around the diretory.

Hi there,

I am resurrecting this (kinda) old thread.

I recently did a reorganisation of my PDF files and folder structure. What this means is that I moved them to other places, did some reshuffling, etc. but all PDF filenames remained the same.

I also tried to clean up the database (as suggested above by @koppor) and to make PDF paths relative. Unfortunately, this did not make PDF paths relative as I can see that they are still fixed as they were.

EDIT: I also just discovered and tried the Automatically set file links option in the Quality menu, to no avail. Mind that in Library → Library properties the General file directory is set to “.” i.e. the directory where the .bib file is located. But JabRef still cannot find the files anyway. It just searches for the files and then says: Finished automatically setting file links. No files found.

What I need to do, actually, is to reconnect all the entries in my .bib database to the original PDF files that were shuffled around. Is this possible at all? Can JabRef rediscover them automatically by filename i.e. author - title [year].pdf?

Hi,

Have you unchecked the option “Search and store files relative to library locaiton”?
This takes precedence over all other options.
And you also need to set the filename format pattern in the preferences under LInked files then to [author] - [title] - [year]

Thanks, I’ll try it and let you know how it went.

BTW why does this have to be so complex and fiddly? All entries already have the filename in them. JabRef can simply search for that filename within a folder structure and discover all files. If there are conflicts, it can simply show a window picker so that the user can resolve them manually (just like with fetching data).

Hi,

sorry for the confusion, I mixed the dialogs up.

JabRef does exactly that, it looks for the files in the folders, that is exactly what the Automatically set linked files does. It’s controlled by these options:

This prevents it from taking up any other unwanted files.

Hi Christoph,

Thanks for attempting to help me. Unfortunately, what you suggested doesn’t work i.e. JabRef finds no files. :frowning_face:

It seems that I’ll have to do this with another, external script or software of a sort. One that would search for strings in the .bib database ending in .pdf, then find the location of the matching filename, and then replacing the path in the .bib database.

Do you have any idea what software can I try for this purpose?

Oh no. We can get this working together!
First of all, try the latest development version of JabRef. index - powered by h5ai v0.29.0 (https://larsjung.de/h5ai/)

Then I need the path info about the location of the pdf and second the path of the bib file. Then I can tell you more