Closed weak-head closed 4 months ago
As of now only rar is supported as archival format, this introduces a necessity of having an external 3rd-party dependency. A python native tar format should be supported, so backups and uploads could work out of the box.
rar
tar
Using tarfile library.
import tarfile import os def create_tar_archive(source_folder, output_tar): with tarfile.open(output_tar, 'w') as tar: for root, _, files in os.walk(source_folder): for file in files: file_path = os.path.join(root, file) arcname = os.path.relpath(file_path, source_folder) tar.add(file_path, arcname=arcname) # Usage source_folder_path = '/path/to/source/folder' output_tar_path = '/path/to/output/archive.tar' create_tar_archive(source_folder_path, output_tar_path) print(f"Archive created at: {output_tar_path}")
Support the following archive providers:
tar.gz
tar.bz2
profiles: archive: - name: tar_default provider: tar - name: tar_gz provider: tar.gz - name: tar_bz2 provider: tar.bz2
Description
As of now only
rar
is supported as archival format, this introduces a necessity of having an external 3rd-party dependency. A python nativetar
format should be supported, so backups and uploads could work out of the box.Implementation Example
Using tarfile library.
Configuration changes
Support the following archive providers:
tar
tar.gz
tar.bz2