Find & Replace in All Notes

I need to do a find & replace across all my notes. The application doesn’t have this feature, but I was wondering about using Notepad++'s “Find in Files”. I sounds like the local data is stored in a database, but the sync data (which I have on a network share) appears to be in markdown files.

If I pointed NP++ to that folder and did “Find in Files” would that accomplish what I want or would it totally corrupt the sync data?

4 Likes

It would corrupt it. For automation, it’s best to use either the API or the CLI app.

I looked at the CLI documentation and didn’t notice anything obvious about find & replace. Does this mean that going the CLI route would require some sort of script that individually opens and searches each note?

@laurent Any thoughts on this (how to use the CLI for find & replace) ?

Yes some kind of script would be needed at the moment.

Has there been any progress on this?

I just migrated a ton of notes from OneNote and now they all have “Created with Microsoft OneNote 2016.” I’d love to Find/Replace all of that garbage text.

1 Like

@itpropaul

I am not in position to test this so it is only a suggestion to consider. Try it only if you are feeling confident.

This uses the idea put forward by @cweinhofer above.

Rather than work on the sync or .config/joplin-desktop folders it may be possible to:

  • export all notes as “File > Export > Raw - Joplin export directory”, you will get a folder full of .md files and a sub-folder full of resources,
  • use Notepad++ on the exported folder (Search > Find in files) to replace the unwanted text with nothing,
  • if happy, set up Joplin on another machine or VM and do not connect it to your sync target,
  • import the modified notes into this testing Joplin setup using “File > Import > Raw - Joplin export directory”,
  • go through your notes in this test setup and make sure that everything is behaving itself,
  • if everything is mangled it’s probably best to give up at this point!
  • if all is fine, delete all notes from the live Joplin and let it sync,
  • possibly go to your online storage provider and delete out anything that remains (not the target folder itself),
  • import the modified notes back into live Joplin using “File > Import > Raw - Joplin export directory”
  • sync

This sounds like it could work as long as the string used for the find value in Notepad++ could not be anything else other than the text sought i.e. a not string that could be required in other contexts in notes or used in metadata files (filename would not be a good choice!).

Created with Microsoft OneNote 2016 seems to be a suitable string to use. In fact before starting look at the Markdown for this sentence so if it is ## Created with Microsoft OneNote 2016 or *Created with Microsoft OneNote 2016* you can use that as the search string (see warning below).

It is assumed the replace value would be blank/nothing.

Things to consider:

  • A JEX - Joplin Export File backup is REQUIRED before trying this. Put it somewhere safe. This could easily go very very wrong.
  • Only try this if you are good at setting up Joplin from scratch on all clients and setting up the sync all over again. You could possibly need to do this just to get back to where you started!!
  • DO NOT set the find / replace options in Notepad++ as RegEx. If you do and then try to replace a Markdown sentence set as italics the last characters may be .*. This is also valid RegEx and means that Notepad++ would replace whatever string you are searching for AND EVERYTHING ELSE AFTER IT. Needless to say this is not a good thing,
  • Probably best to also set the find / replace not to be recursive so it does not search through the resources folder as well, finally,
  • Do you really want to do this or could you just delete Created with Microsoft OneNote 2016 every time you encounter a note with it in. Over time they will all go and any left will only be on notes you have never re-read!!!
4 Likes

Wow, what a thoughtful response! Thanks so much, I will try this.

And your last point is valid. :smiley: Coming from being a sysadmin for ~10 years, I have a penchant to automate things. So this request wasn't just for this one isolated use case, it was also for times in the future where I may want to do something similar.

1 Like

I wrote the above with a more inexperienced user in mind. Seeing you have been a sysadmin for 10 years I realise that due to the "sysadmin's secret code of conduct" you will try this on a live system without backups :slight_smile:

3 Likes