Page 1 of 1

[Files] - Migration to another Volume

Posted: Tue May 09, 2017 9:57 pm
by Axel_H
As a new user I looked into how I would migrate to another Volume (for example another computer or hard disk).

While moving the CintaNotes application and SQLite DB should work without problem, I would have to retarget all links to local files.
(Let us assume I keep all linked local files in a single directory with subfolders)

Example
before migration: Note 1 link to F:\\myfiles\text.txt
after migration: Note 1 link to network_path\myfiles\text.txt.

In order to speed up the relinking I wish a command to change the link of all linked files on 'F:\' to 'network_path'.

Basically this command takes user input for 'old volume' and 'new volume' and executes an SQL update on Notes:link where Notes:link begin with 'old volume'.

With the intention not to burden the GUI with such rarely used command it may be good to implement this by starting CintaNotes with parameters \SQL.txt from the command line. To the effect of executing an SQL statement in a SQL.txt file in the install directory. (This may be a bit too techie for the common user though.)

Re: [Files] - Migration to another Volume

Posted: Wed May 10, 2017 3:28 am
by gunars
Another approach you might try is to export the notes into an xml file. You can then edit that file to make any directory or network changes you need in any editor. Finally, import the modified file into a new database.

Re: [Files] - Migration to another Volume

Posted: Wed May 10, 2017 6:54 am
by CintaNotes Developer
+1 to Gunars.
Export your DB to XML, search-and-replace the paths, then import it into a new DB on the new volume.

A bit advanced option:
If you are using NTFS filesystem, also a handy trick would be to create a directory junction to your target folder that would be inside of a portable CintaNotes folder (if you don't know how to do it, google for "how to create directory junction"). Then using XML change the paths to use relative paths like this: "linkedfiles\mylikedfile.txt". (where "CintaNotes\linkedfiles" is your junction folder). After that whereever you move your data you won't have to change the paths, only recreate the junction folder. However you'll have to take care to attach files only from the junction folder.

Re: [Files] - Migration to another Volume

Posted: Wed May 10, 2017 10:21 pm
by Axel_H
Thanks for the insight, guys!

For me exporting a data base and importing it again always looks a bit risky. But if it works reliably, then why not?
Only downside could be if I ever have in a note's text body a mention of that volume. For example I change path from 'C:\' to 'G:\' and have written in a note 'operating systems usually reside on C:'.

Good hint for the directory junction as well. I will try that as well.

Re: [Files] - Migration to another Volume

Posted: Thu May 11, 2017 12:05 am
by gunars
If you want to make sure you only look at actual file links, you would need to look for a construction like the following in the body of the note:

<notelink path="cintanotes:///file/C:\temp\example\test.pdf">test.pdf</notelink>

You could then search and replace "cintanotes:///file/C:\temp\example\" with "cintanotes:///file/G:\new\path\".

If you take a sample note with the sort of links you have and export just that one note to XML, you can see how it's formatting the links.

As far as I know, importing from an XML file (that was exported by CN) should be as reliable as importing from an existing .db file. And, since you'd be importing it into a new notebook/database, the original would remain untouched.

Re: [Files] - Migration to another Volume

Posted: Thu May 11, 2017 5:30 am
by CintaNotes Developer
Again, +1 to Gunars.

XML export/import works reliably, the added bonus being that it reduces size of the database. However note that it doesn't export/import contents of Recycle Bin. Also, if you use Simplenote sync, some extra steps are needed to avoid note duplication.

Re: [Files] - Migration to another Volume

Posted: Thu May 11, 2017 4:16 pm
by gunars
Hi Alex

What are these extra steps for Simplenote and when are they needed?

I've just started using the CN to Simplenote sync and it's working great! I had initially ignored this feature since I wasn't using Simplenote. I've now started using Simplenote only because of this feature. :-) It's an easy way for me to take some quick notes on my phone and get them into CN (or to make some CN notes available on my phone). Great feature and a simple, lightweight solution in keeping with the spirit of CN!

Gunars

Re: [Files] - Migration to another Volume

Posted: Thu May 11, 2017 8:22 pm
by Axel_H
Thanks Gunars,

yes, to include the field name in the search string is the way to go.

Compacting a data base by export and import- now that would have never crossed my mind.

Re: [Files] - Migration to another Volume

Posted: Fri May 12, 2017 4:20 am
by CintaNotes Developer
Gunars,

well basically CN keeps some Simplenote-related bookkeeping data that is not exported to XML.

Later when a new notebook is connected to the same Simplenote account, it can lead to note duplication.

The safe way to go about this is to export only non-Simplenote-synced notes to XML, and later get part of the notes via Simplenote sync, and the rest by import.