Script to import md files (with first line as title)

Import markdown files to Joplin with first line as title.

Usage:
  md_file_import.py <path_to_md_files> [--is_todo]
  md_file_import.py (-h | --help)
  md_file_import.py --version

Options:
  -h --help     Show this screen.
  --version     Show version.
  --is_todo     Are markdown files todos or not.
5 Likes

Thanks for sharing!

1 Like

How is this really different from the cli import function? What is your specific use case for the script?

Instead of using the file name as title, my script use the first line of md files as title. I wrote it for myself because i had 10k+ md files with the format of 0.md 1.md 2.md 3.md and in every file the title was in the first line of every file.

hi-
sorry for the late request, but is there a way to have a default tag added to the note also?

I'm trying to import 655 notes, I run the script and the progress bar very slowly reaches 100%, but the counter remains at 0/655.

When it finishes, it says that it imported 0/655 notes. No new notes are added to Joplin.

Any ideas?

Just a wild guess after taking a brief look at the script: Did you:

  1. Enable the webclipper inside Joplin and add the token in the script? md_file_import ($1871587) · Snippets · GitLab
  2. Add the target folder to the script? md_file_import ($1871587) · Snippets · GitLab

It might be more convenient to use the built-in import function at "File -> Import -> Markdown (Directory)"