Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Import Filenames?

2007-07-06
2013-05-28
  • Hello all,

    Is there anyway to import file names as part of any of the supported formats into Refbase? I'd like to upload my Bookends Attachments folder to the server, and be able just to pick up the files from the imported references.

    Thanks,

    John

     
    • Hi John,

      while you cannot auto-fill the 'file' field via an import format, it is possible to populate the 'file' field via SQL commands.

      If you can uniquely match record entries in your refbase database with files in your attachment folder, then you could use a text editor to generate multiple SQL commands such as this one:

      UPDATE refs SET file = "file_path/file_name.pdf" WHERE serial = 12345;

      E.g., if your file names are unique across all files within your attachment folder, and if you can import the file name for each record into another field (such as the 'notes' field), then you could use:

      UPDATE refs SET file = "file_path/file_name.pdf" WHERE notes RLIKE "file_name\.pdf";

      However, the exact procedure depends on your specific setup.

      Alternatively, you could import the file path into a field that's supported on import but that isn't used in your data, then move the file info to the 'file' field. E.g., if your records don't have any notes, you could insert your file path info into the 'notes' field via appropriate tags:

      BibTeX: note
      Endnote: %O
      RIS: N1

      After import, you'd move file paths from the 'notes' field to the 'file' field:

      UPDATE refs SET file = notes WHERE created_date = CURDATE();
      UPDATE refs SET notes = "" WHERE created_date = CURDATE();

      These examples assume that you haven't imported anything else during the day.

      Moving path info from the 'notes' field to the 'file' may even be possible if the 'notes' field contains other stuff as well, but may require the use of a unique path spec prefix as well as some clever user of the SQL REPLACE() function.

      For a more concrete suggestion, I'd need more details about your record & file data.

      Matthias

       
    • Thank you Matthias! - for both the speed and detail of your response.

      This worked wonderfully. I had a hard time finding a field I didn't need, but I finally set the filenames to ISSN in a BibTex export. And then used the last couple database queries you wrote.

      How is RefBase progressing these days? I notice the last tar.gz was packaged back in October, but in SVN, there have been updates as recently as 6 weeks ago. Has much changed? I installed the packaged version, would it be worth doing SVN?

      Best wishes and thanks all for this helpful tool,

      John

       
      • John, I'm happy that it did work for you!

        > How is RefBase progressing these days?

        Slow but very steadily.

        > I notice the last tar.gz was packaged back in October

        That's correct. Issuing a package release is actually quite a bit of work which is why it's not happening as often as we'd like to.

        > but in SVN, there have been updates as recently as 6 weeks ago.

        The most recent modifications were checked into the bleeding-edge branch of our SVN repository about a day ago.

        > Has much changed?

        For the version in the SVN trunk (which should be pretty stable), see:

        http://sourceforge.net/forum/forum.php?thread_id=1741877&forum_id=351913

        > I installed the packaged version, would it be worth doing SVN?

        It depends on your needs (see the link above), but normally, I'd say that the packaged version should do fine.

        Matthias

         
    • Thanks again for your help, Matthias. It's much appreciated!
      John