helpers¶
- gonto.helpers.dict_merge(dest: dict[Any, Any], other: dict[Any, Any]) None¶
Deep merge of
"other"dict in"dest"dict.- Parameters:
dest – Destination dict.
other – Other dict to merge into
dest.
>>> d1 = {"a": 1, "b": {"c": 3}, "d": 4, "f": 5} >>> d2 = {"b": {"e": 10}, "d": 14, "f": {"f": 15}} >>> dict_merge(d1, d2) >>> d1 {'a': 1, 'b': {'c': 3, 'e': 10}, 'd': 14, 'f': {'f': 15}} >>> d2 {'b': {'e': 10}, 'd': 14, 'f': {'f': 15}}
- gonto.helpers.ntfs_disk_use(folder: Path | str, cluster_size: int = 4096, mft_record_size: int = 1024) tuple[int, int, int, int]¶
Estimates “physical” disk usage of a folder and its files on a NTFS file system.
- Parameters:
folder – The input folder.
cluster_size – The size of a cluster (minimal disk space that can be allocated to hold a file) on the file system (default: 4096).
mft_record_size – The size of a record in the master file table (generaly 1024 B so it is our default).
- Returns:
A tuple of 4 integers containing:
The estimated file and folder size on an NTFS file system
The raw size of the files
The folder count
The file count