Skip to content

Commit ddc5fa0

Browse files
committed
Zip Creator feature added
1 parent ada7502 commit ddc5fa0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

zip_creator.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import zipfile
2+
from pathlib import Path
3+
4+
def create_archive(file_paths, to_folder_path):
5+
path = Path(to_folder_path, "compress.zip")
6+
7+
with zipfile.ZipFile(path, "w") as archive:
8+
for file_path in file_paths:
9+
file_path = Path(file_path)
10+
archive.write(file_path, arcname=file_path.name)
11+
12+
13+
def unzipper(archive_path, to_folder_path):
14+
with zipfile.ZipFile(archive_path, "r") as archive:
15+
archive.extractall(to_folder_path)

0 commit comments

Comments
 (0)