This Backup Tool allows you to take snapshots of a specific directory, listing existing snapshots, restoring files from snapshots, and optionally taking snapshots at regular intervals for a specified duration. The backups are saved as JSON files, storing both the metadata of files (like paths and hashes) and their content encoded in Base64 format.
- Take snapshots of a target directory.
- List all available snapshots.
- Restore files from a selected snapshot.
- Run a snapshot job to take continuous snapshots at defined intervals.
- Prune old snapshots (to be implemented).
Ensure you have Python 3 installed. You can run the script directly, as it doesn't require any additional dependencies.
Run the script from the command line using the following commands:
Take a snapshot of a target directory.
python backuptool.py snapshot --target-directory /path/to/your/directoryList all available snapshots.
python backuptool.py listRestore files from a selected snapshot to a specified output directory.
python backuptool.py restore --snapshot-file snapshot_filename.json --output-directory /path/to/restore/directoryPrune old snapshots, keeping only the specified number.
python backuptool.py prune --snapshot-number NRun a job to take snapshots of a target directory at specified intervals for a defined duration.
python backuptool.py job --target-directory /path/to/your/directory --interval INTERVAL_DURATION --duration TOTAL_DURATIONINTERVAL_DURATION: The time to wait between each snapshot in seconds.TOTAL_DURATION: The total time the job should run in seconds.
To take snapshots every 10 seconds for 1 minute:
python backuptool.py job --target-directory /path/to/your/directory --interval 10 --duration 60- snapshots/: Directory where all snapshot JSON files will be saved.
- The script itself will create the snapshots directory if it does not exist.
- Python 3.x
This project is licensed under the MIT License - see the LICENSE file for details.
- Thanks to the open-source community for the frameworks and libraries that make this possible.