Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1281,15 +1281,14 @@ def create_pdf(cname,ename,account_number, directory):
|
|
| 1281 |
|
| 1282 |
def zip_files_in_folder(directory, output_zip):
|
| 1283 |
# Initialize the ZIP file
|
| 1284 |
-
directory = "./"
|
| 1285 |
with zipfile.ZipFile(output_zip, 'w', zipfile.ZIP_DEFLATED) as zipf:
|
| 1286 |
-
#
|
| 1287 |
-
for
|
| 1288 |
-
|
| 1289 |
-
|
| 1290 |
-
|
| 1291 |
-
|
| 1292 |
-
|
| 1293 |
print(f"ZIP file created: {output_zip}")
|
| 1294 |
|
| 1295 |
def directory_exists(repo_id, directory, token):
|
|
|
|
| 1281 |
|
| 1282 |
def zip_files_in_folder(directory, output_zip):
|
| 1283 |
# Initialize the ZIP file
|
|
|
|
| 1284 |
with zipfile.ZipFile(output_zip, 'w', zipfile.ZIP_DEFLATED) as zipf:
|
| 1285 |
+
# List all files in the directory
|
| 1286 |
+
for file in os.listdir(directory):
|
| 1287 |
+
file_path = os.path.join(directory, file)
|
| 1288 |
+
# Check if it's a PDF file and a regular file (not a directory)
|
| 1289 |
+
if file.endswith(".pdf") and os.path.isfile(file_path):
|
| 1290 |
+
# Add file to the ZIP archive
|
| 1291 |
+
zipf.write(file_path, file) # Save with its filename in the ZIP
|
| 1292 |
print(f"ZIP file created: {output_zip}")
|
| 1293 |
|
| 1294 |
def directory_exists(repo_id, directory, token):
|