> **Use at your own risk.** This script has not been thoroughly tested. Always make sure you have a backup of your files before running it, especially with the `mv` (move) operation. The author takes no responsibility for any data loss or damage caused by the use of this script.
A command-line utility to restore files from a flat TeleDrive export dump back into their original folder hierarchy, using the metadata exported from TeleDrive as a `files.json` file.
## Requirements
- Python 3.6 or newer (no third-party packages required)
## Background
TeleDrive stores all uploaded files in Telegram as flat message attachments. When you export your data, you get:
1. A `files.json` metadata file describing every file and folder, including parent-child relationships.
2. A flat directory of downloaded files, all sitting in the same folder.
This script reads the metadata and reconstructs the full directory tree, placing every file in its correct folder.
Copyright (C) 2026 Anders da Silva Rytter Hansen, PC-Rytteren ApS
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
See the [LICENSE](LICENSE) file for the full license text.