A bash script that converts LogSeq markdown files into a single consolidated file suitable for import into NotebookLM. The script includes safety measures, automated backups, and clear user feedback throughout the migration process.
- Automated backup creation before migration
- Merges both journals and pages from LogSeq
- Maintains original file hierarchy in the output structure
- Progress indicators and detailed feedback
- Comprehensive error handling
- Cleanup of temporary files
- Statistics about the migration process
- macOS operating system
- Bash shell
- Read/write permissions for the LogSeq directory
- Sufficient disk space for backup and temporary files
- Download the script:
curl -O https://raw.githubusercontent.com/[username]/logseq-to-notebooklm/main/logseq_to_notebooklm.sh
- Make the script executable:
chmod +x logseq_to_notebooklm.sh
Run the script by providing the path to your LogSeq directory as an argument:
./logseq_to_notebooklm.sh /path/to/your/logseq/directory
Alternatively, set the LOGSEQ_DIR environment variable and run the script:
export LOGSEQ_DIR=/path/to/your/logseq/directory
./logseq_to_notebooklm.sh
The script generates:
- A timestamped backup of your LogSeq directory in
~/Documents/logseq_backups/
- A consolidated markdown file named
notebooklm_import_[timestamp].md
in the current directory
The script expects your LogSeq directory to have the following structure:
logseq_directory/
├── journals/
│ └── *.md files
└── pages/
└── *.md files
Backups are automatically created in:
~/Documents/logseq_backups/backup_YYYYMMDD_HHMMSS/
The script includes error handling for common scenarios:
- Missing input directory
- Invalid directory structure
- Permission issues
- Failed backup attempts
- Empty output file
The script includes several variables at the top that can be modified to customize behavior:
TEMP_DIR
: Location for temporary filesBACKUP_DIR
: Location for backupsOUTPUT_FILE
: Name pattern for the output file
- The script creates a complete backup before making any changes
- Temporary files are automatically cleaned up after execution
- The output file maintains a clear separation between journals and pages
- Each file is preceded by its filename as a header
- Progress messages are color-coded for better visibility
If you encounter issues:
- Ensure you have proper permissions for the LogSeq directory
- Check available disk space
- Verify the LogSeq directory structure
- Review the error messages for specific issues
- Designed specifically for macOS
- Handles only markdown files
- Assumes standard LogSeq directory structure
Feel free to submit issues and enhancement requests!
MIT License
- 1.0.0 (2025-01-26)
- Initial release
- Basic migration functionality
- Backup and safety features