Skip to content
Snippets Groups Projects
Commit ddf4d47c authored by Mathieu Beligon's avatar Mathieu Beligon
Browse files

[utils] Add path utils

parent 237f66b4
No related branches found
No related tags found
No related merge requests found
from pathlib import Path
from shutil import copy, make_archive, move
from typing import Iterable
def move_file(source: Path, destination_directory: Path):
destination_directory.mkdir(exist_ok=True, parents=True)
move(str(source), str(destination_directory))
def move_files(sources: Iterable[Path], destination_directory: Path):
for source in sources:
move_file(source, destination_directory)
def copy_file(source: Path, destination_directory: Path):
destination_directory.mkdir(exist_ok=True, parents=True)
copy(str(source), str(destination_directory))
def archive_directory(directory:Path):
make_archive(str(directory), "zip", str(directory))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment