Skip to content

Commit

Permalink
less lines for folder_files and size
Browse files Browse the repository at this point in the history
  • Loading branch information
ychiucco committed Aug 26, 2024
1 parent e4ad58a commit 041a825
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions fractal_server/zip_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,14 @@ def iterfile():
def _zipping_worked(*, folder: str) -> bool:

zip_file = f"{folder}_tmp.zip"
folder = Path(folder)

# CHECK 1: zip file exists
if not os.path.exists(zip_file):
return False

folder_size = 0
folder_files = set()
for dirpath, dirnames, filenames in os.walk(folder):
for f in filenames:
fp = os.path.join(dirpath, f)
folder_files.add(os.path.relpath(fp, folder))
folder_size += os.path.getsize(fp)
folder_files = [f for f in folder.glob("**/*") if f.is_file()]
folder_size = sum(f.stat().st_size for f in folder_files)

with ZipFile(zip_file, "r") as zip_ref:
zip_files = set(
Expand Down

0 comments on commit 041a825

Please sign in to comment.