A simple Tkinter GUI application for working with Moodle backup files (.mbz format).
- Decompress MBZ files (which are tar.gz archives) to a folder
- Compress a folder back into an MBZ file in the proper format for Moodle import
- Analyze MBZ files to check their structure
- Simple, user-friendly interface
- Python 3.6 or higher
- Standard Python libraries (no additional installations required):
- tkinter (usually comes with Python)
- os
- tarfile
- gzip
- shutil
-
Run the program:
python mbz_editor.py -
To decompress an MBZ file:
- Click the "Decompress" tab
- Select the .mbz file
- Choose an output directory
- Optionally check/uncheck "Open folder after extraction"
- Click "Decompress MBZ File"
- The contents will be extracted to a folder with the same name as the .mbz file
-
To compress a folder to MBZ:
- Click the "Compress" tab
- Select the folder containing the extracted MBZ contents
- Choose where to save the new .mbz file
- Click "Compress to MBZ File"
- The folder will be compressed in the correct format for Moodle import
-
To analyze an MBZ file:
- Click the "Analyze" tab
- Select the .mbz file
- Click "Analyze MBZ File"
- Review the file structure and contents
- MBZ files are tar.gz archives with a specific structure required by Moodle
- After decompressing, you can manually edit the XML files before compressing again
- When compressing, the folder structure must remain exactly as it was when extracted
- The compression method preserves the paths exactly as needed for Moodle import
- Do not add, rename, or move files/folders within the extracted structure unless you know what you're doing
If you encounter import issues with your compressed MBZ file:
- Make sure you haven't changed the folder structure after extraction
- Ensure all XML files are valid if you've made manual edits
- Check that you have permission to read/write to the selected directories
- If the issue persists, try using the original Moodle backup functionality instead
The application uses Python's tarfile module to extract and create tar.gz archives. The key to successful MBZ file handling is maintaining the exact file paths and structure that Moodle expects. The compression function preserves these paths by temporarily changing to the parent directory of the source folder before adding files to the archive.