Closed MrMino closed 3 years ago
Seems like something like the following will do what you want here.
filename = Path(filename)
if recursive and filename.is_dir():
with open(self._zip, arcname) as wf:
for path in filename.rglob("*"):
with wf.open(path, "wb") arcfile, path.open("rb") as rawfile:
arcfile.write(rawfile.read())
@e2thenegpii yea, I have that already, I just wanted it test-first for the sake of my conscience and didn't had the time to finish it. Will do tomorrow.
Closes #1
write
andwrite_data
haverecursive
kwargsrecursive arg
recursive=True
and a directory infilename
,write
walks over every file in the subtree and adds it accordinglywrite_data
passesrecursive
towrite
recursive=True
arcname
, if given, sets correct archive name for the directory