filemanager.Archiver
Archive folders and files.
Usage
filemanager.Archiver(
source_dir,
archive_dir,
)Methods
| Name | Description |
|---|---|
| __init__() | Initialize logger and archive parameters. |
| archive() | Perform the archive by copying the source directory to the archive directory |
| get_archive_dir() | Generate a timestamped archive directory path. |
__init__()
Initialize logger and archive parameters.
Usage
__init__(source_dir, archive_dir)Parameters
source_dir: str or Path-
The directory to copy or archive.
archive_dir: str or Path- The destination directory for the archive.
archive()
Perform the archive by copying the source directory to the archive directory
Usage
archive()and then creating a zip file of the archived folder.
Raises
SameFileError-
If the source and destination are the same.
OSError- For other filesystem-related errors.
get_archive_dir()
Generate a timestamped archive directory path.
Usage
get_archive_dir(base_dir, project_name)Parameters
base_dir: str or Path-
The base directory where archives are stored.
project_name: str- The name of the project being archived.
Returns
Path- A path to the timestamped archive directory.