stouputils.backup.retrieve module#
- get_all_previous_backups(
- backup_folder: str,
- all_before: str | None = None,
Retrieves all previous backups in a folder and maps each backup to a dictionary of file paths and their hashes.
- Parameters:
backup_folder (str) – The folder containing previous backup zip files
all_before (str | None) – Path to the latest backup ZIP file (If endswith “/latest.zip” or “/”, the latest backup will be used)
- Returns:
Dictionary mapping backup file paths to dictionaries of {file_path: file_hash}
- Return type:
dict[str, dict[str, str]]
- is_file_in_any_previous_backup(
- file_path: str,
- file_hash: str,
- previous_backups: dict[str, dict[str, str]],
Checks if a file with the same hash exists in any previous backup.
- Parameters:
file_path (str) – The relative path of the file
file_hash (str) – The SHA-256 hash of the file
previous_backups (dict[str, dict[str, str]]) – Dictionary mapping backup zip paths to their stored file hashes
- Returns:
True if the file exists unchanged in any previous backup, False otherwise
- Return type:
bool