Skip to content

jaylaney/migrate-logseq-journals

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

migrate-logseq-journals

Migrate daily journal notes (and referenced pages and assets) between Logseq graphs.

Copies journal .md files dated before a cutoff date from a source graph to a destination graph. Referenced pages are followed two levels deep, and any linked assets are included automatically.

Requirements

Python 3.10+ (no external dependencies).

Setup

Place the script alongside your Logseq graph directories, or pass absolute paths:

migrate-logseq-journals/
├── migrate_logseq_journals.py
├── SourceGraph/
│   ├── journals/
│   ├── pages/
│   └── assets/
└── DestGraph/
    ├── journals/
    ├── pages/
    └── assets/

Usage

python3 migrate_logseq_journals.py SOURCE DEST --before YYYY-MM-DD [options]

Run --help for full flag descriptions.

Typical workflow

1. Preview the migration:

python3 migrate_logseq_journals.py Janet Personal --before 2022-01-10 --dry-run

2. Run the migration:

python3 migrate_logseq_journals.py Janet Personal --before 2022-01-10

3. Verify in Logseq — open the destination graph, re-index, and spot-check a few dates.

4. Clean up source originals:

python3 migrate_logseq_journals.py Janet Personal --before 2022-01-10 --cleanup

This only deletes source files that are >=80% similar to what's already in the destination.

How it works

  1. Journals — collects .md files from SOURCE/journals/ dated before the cutoff. If a journal already exists in the destination, near-duplicates (>=80% similarity) are skipped and divergent content is merged with a separator header crediting the source graph.
  2. Pages (level 1) — extracts [[page refs]], #[[tag refs]], and #tags from the collected journals and copies the matching page files from SOURCE/pages/.
  3. Pages (level 2) — repeats reference extraction on level-1 pages for one additional hop.
  4. Assets — finds ../assets/filename references across all collected content and copies the matching files from SOURCE/assets/.

Empty/stub pages (<=1 byte) are skipped by default. Use --include-empty to copy them.

License

This project is unlicensed. Use at your own risk.

About

Migrate daily journal notes (and referenced pages/assets) between Logseq graphs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages