BaoNhan commited on
Commit
cec1f49
·
verified ·
1 Parent(s): 13a7fd4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -4
app.py CHANGED
@@ -159,14 +159,10 @@ def compress_directory_to_zip(directory_path, output_zip_path):
159
  try:
160
  with zipfile.ZipFile(output_zip_path, 'w', zipfile.ZIP_DEFLATED) as zipf:
161
 
162
- # 遍历目录中的所有文件和子目录
163
  for root, dirs, files in os.walk(directory_path):
164
  for file in files:
165
- # 构建完整的文件路径
166
  file_path = os.path.join(root, file)
167
- # 计算相对路径
168
  arcname = os.path.relpath(file_path, directory_path)
169
- # 添加文件到 ZIP 文件
170
  zipf.write(file_path, arcname)
171
  return 0
172
  except Exception as e:
 
159
  try:
160
  with zipfile.ZipFile(output_zip_path, 'w', zipfile.ZIP_DEFLATED) as zipf:
161
 
 
162
  for root, dirs, files in os.walk(directory_path):
163
  for file in files:
 
164
  file_path = os.path.join(root, file)
 
165
  arcname = os.path.relpath(file_path, directory_path)
 
166
  zipf.write(file_path, arcname)
167
  return 0
168
  except Exception as e: