gpf_entrepot_toolbelt.utils.archive_utils module¶
- gpf_entrepot_toolbelt.utils.archive_utils.compress_archive(input_dir_path: Path, archive_file: Path, split_size: int | None = None) Status¶
Handle the normalized results by compressing them into an archive or copying them.
- Paramètres:
input_dir_path (Path) – Path to the directory containing the normalized results.
archive_file (Path) – Path to the archive to create
split_size (int, optional) – Size of the parts to split the archive into (only for 7z). Defaults to None.
- Returns
Status: The status of the compression process
- gpf_entrepot_toolbelt.utils.archive_utils.extract_archive(archive_file: Path, output_dir_path: Path) Status¶
Extract the archive file to the specified folder.
- Paramètres:
archive_file (Path) – Path of the archive file.
output_dir_path (Path) – Folder where the archive file will be extracted.
- Renvoie:
The status of the extraction process
- Type renvoyé:
- gpf_entrepot_toolbelt.utils.archive_utils.get_archive_extension(archive_path: Path) str | None¶
Get the archive extension of a path based on its name.
- Paramètres:
archive_path (Path) – the path to check.
- Renvoie:
The archive extension, e.g., “7z”, “tar”, “tar.gz”/”tgz”, “tbz2”/”tar.bz2”, “gz”, “bz2”, “rar” or “zip”. None: if the extension is not recognized
- Type renvoyé:
str
- gpf_entrepot_toolbelt.utils.archive_utils.is_section(file_name: Path) bool¶
Returns true if the file is an archive type with a numeric part extension like .zip.001, .7z.002 or.tar.003.
- Paramètres:
file_name (Path) – file to check.
- Renvoie:
True if the file is an archive section, False otherwise.
- Type renvoyé:
bool
- gpf_entrepot_toolbelt.utils.archive_utils.list_archive_files(archive_file: str | Path) list[str] | Status¶
Return a list of files and directories contained in an archive.
- Paramètres:
archive_file (str) – path to the archive.
- Lève:
ValueError – if the archive extension is not supported
TypeError – if the input path is not a str or a Path
- Renvoie:
list of files and directories contained in the archive
- Type renvoyé:
list[str]