gpf_entrepot_toolbelt.utils.os_utils module¶
- gpf_entrepot_toolbelt.utils.os_utils.convert_to_bytes(size_str: str)¶
Converts a size string to bytes.
- Paramètres:
size_str (str) – Size string (e.g. « 10MB »)
- Renvoie:
Size in bytes
- Type renvoyé:
int
- gpf_entrepot_toolbelt.utils.os_utils.copytree(source_path: Path, target_path: Path)¶
Copy a source path into a target path, keeping the original name
- Paramètres:
source_path (Path) – Path to the file/directory to copy
target_path (Path) – Path to the target directory
- gpf_entrepot_toolbelt.utils.os_utils.create_symlink(elements: Iterable[Path], target_dir: Path, add_parent_as_suffix: bool = False)¶
Create symbolic links.
- Paramètres:
elements (Iterable[Path]) – elements to add to the virtual folder
target_dir (Path) – virtual folder to create and add elements to
add_parent_as_suffix (bool) – adds the parent folder of a file to its symlink name as a suffix
- gpf_entrepot_toolbelt.utils.os_utils.recursively_find_deepest_unique_folder(directory: Path) Path ¶
- Recursively find the deepest unique folder in the given directory
- i.e. :
- in hierarchy :
- path1
- L path2
L path3 L path4
the deepest unique folder is « path2 »
- Paramètres:
directory (Path) – Path to a folder
- Renvoie:
Path to the deepest unique folder in the given directory.
- Type renvoyé:
Path
- gpf_entrepot_toolbelt.utils.os_utils.remove_path(path: Path)¶
Removes a file or a directory.
- Paramètres:
path (Path) – Path to the file or directory to remove
- Renvoie:
None