nlrepack¶
- nlrepack(path, fail_silently=False)¶
Repacks the specified file(s). If path is a directory, it will be walked recursively and all contained hdf5 files will be repacked. If the reclaimed free space is smaller than 1 MB, the operation is discarded.
- Parameters:
path (str) – The filename or directory.
fail_silently (bool) – If True, the function will not raise an exception if h5repack is not found. Instead, a warning will be written to the log.
- Returns:
The freed disk space in MB.
- Return type:
float
Usage examples¶
To repack the hdf5 file my_file.hdf5
and reclaim unused space (for deleting
QuantumATK objects from hdf5 files see nldelete)
nlrepack('my_file.hdf5')
or to repack all files in a given directory /my/directory
and its subdirectorys.
nlrepack('/my/directory')