How can I export certain ntoebooks to a certain system folder on using the cli?

Hi

I would like to set up regular export job. I want to export certain notebooks to certain filesystem folders as markdown with attachments (they will be in the same folder undr a subfolder hopefully). I am wondering how I can do this with the Joplin CLI client.

thanks

For this I'd recommend joplin export --format md_frontmatter /path/to/folder as that will export everything including attachments and most of the metadata (as a frontmatter header).

1 Like

If you want to automatically backup and version your notes you can use a cron script like this:

#!/bin/bash

set -e

BACKUP_DIR="/path/to/dir"
JOPLIN_BIN="$HOME/.npm-global/bin/joplin"

$JOPLIN_BIN sync
$JOPLIN_BIN e2ee decrypt

cd "$BACKUP_DIR"
rm -f *.md
rm -f resources/*
$JOPLIN_BIN --log-level debug export --format raw "$BACKUP_DIR"
git add .
git commit -m "Update"
2 Likes

@laurent

Thanks for the solution, I think this will work for me. How do I export only a notebook or a subnotebook under another one?

I forgot if that can be done. But all the help is there if you type joplin help export

1 Like

The commands are in the terminal docs and also in joplin help export

export <path>

    Exports Joplin data to the given path. By default, it will export the
    complete database including notebooks, notes, tags and resources.

    --format <format>      Destination format: jex (Joplin Export File), raw
                           (Joplin Export Directory), json (Json Export
                           Directory), md (Markdown), html (HTML File), html
                           (HTML Directory)
    --note <note>          Exports only the given note.
    --notebook <notebook>  Exports only the given notebook.

One issue is if you have notebooks of the same name so if you do you may want to use the internal id in place of the notebook name which you can get from joplin ls / -l

So instead of joplin export ~/jopexport --format md_frontmatter --notebook books you might use joplin export ~/jopexport --format md_frontmatter --notebook 86f1c

2 Likes

Thanks, that isa greeat tip. It looks like what I need to do is totally possible in Joplin.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.