Clean Notion exports for import into Trilium Notes, Obsidian, Joplin, and other note-taking applications.
Notion appends 32-character hash identifiers to every exported filename and directory. This breaks filenames, folder names, and internal links when importing into other tools. This script strips those hashes and fixes all internal references automatically.
- Extracts your Notion export zip (handles nested zips automatically)
- Recursively removes Notion hash suffixes from all filenames and directories
- Fixes all internal links (
%20<hash>references) inside Markdown and HTML files - Outputs a clean zip ready to import
- Preserves note hierarchy and folder structure
BB f708f1d322674a1faf7e67f8c3a05a48/
AI Products to 31497b48837a803da1d8dab26ed32fe0/
test 1ae97b48837a80efb19bd0ec7f81e32b.html
BB f708f1d322674a1faf7e67f8c3a05a48.html
BB/
AI Products to/
test.html
BB.html
- Bash 3.2 or later (ships with macOS, Linux, Git Bash, WSL)
unzip,zip,sed,sort,grep
git clone https://github.com/<your-username>/notion-export-cleaner.git
cd notion-export-cleaner
chmod +x notion2trilium.sh
Or download notion2trilium.sh directly and make it executable.
Go to Settings > Export in Notion. Choose Markdown or HTML format. Download the zip file.
notion-export-cleaner/
notion2trilium.sh
your-notion-export.zip
Interactive mode -- finds all zips in the current directory and lets you pick:
./notion2trilium.sh
Found 3 zip files:
[1] notion-export-part1.zip (12 MB)
[2] notion-export-part2.zip (8 MB)
[3] old-backup.zip (3 MB)
Select a file [1-3]: 1
Or pass the zip directly:
./notion2trilium.sh your-notion-export.zip
The script extracts, cleans, and produces your-notion-export-Clean.zip when finished.
- Trilium Notes: File > Import into note > select the zip
- Obsidian: Unzip into your vault folder
- Joplin: File > Import > select the zip
| Platform | Status |
|---|---|
| macOS | Tested |
| Linux | Supported |
| Windows (WSL) | Supported |
| Windows (Git Bash) | Supported |
Notion exports use the format Note Title <32-char-hex-hash>.extension for files and Folder Name <32-char-hex-hash> for directories. The hash is a unique Notion block identifier.
The script:
- Extracts the selected zip into a working directory (unpacks nested zips if present)
- Walks the directory tree and identifies filenames containing a trailing 32-character hexadecimal string
- Renames each file/directory by removing the
<hash>portion - Records every hash found
- Walks the tree again and removes
%20<hash>from all internal links in text files - Zips the cleaned result and removes the working directory
Internal links in Notion exports use URL-encoded paths like Note%20Title%2031497b48837a803da1d8dab26ed32fe0. After the hash is stripped from the filename, the link must also be updated to Note%20Title so it resolves correctly.
MIT