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.
Python 3.10+ (no external dependencies).
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/
python3 migrate_logseq_journals.py SOURCE DEST --before YYYY-MM-DD [options]Run --help for full flag descriptions.
1. Preview the migration:
python3 migrate_logseq_journals.py Janet Personal --before 2022-01-10 --dry-run2. Run the migration:
python3 migrate_logseq_journals.py Janet Personal --before 2022-01-103. 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 --cleanupThis only deletes source files that are >=80% similar to what's already in the destination.
- Journals — collects
.mdfiles fromSOURCE/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. - Pages (level 1) — extracts
[[page refs]],#[[tag refs]], and#tagsfrom the collected journals and copies the matching page files fromSOURCE/pages/. - Pages (level 2) — repeats reference extraction on level-1 pages for one additional hop.
- Assets — finds
../assets/filenamereferences across all collected content and copies the matching files fromSOURCE/assets/.
Empty/stub pages (<=1 byte) are skipped by default. Use --include-empty to copy them.
This project is unlicensed. Use at your own risk.