Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -142,20 +142,27 @@ def process_directory(directory, partial_paths=None, file_paths=None):
|
|
142 |
else:
|
143 |
tmpsubdirpath = tmpdirname
|
144 |
|
145 |
-
if partial_paths:
|
146 |
-
print("Go in partial_paths")
|
147 |
-
for partial_path in partial_paths:
|
148 |
-
files += get_all_files_in_folder(tmpsubdirpath, partial_path)
|
149 |
-
|
150 |
-
else:
|
151 |
-
print("wtf")
|
152 |
for root, _, files_list in os.walk(tmpdirname):
|
153 |
for file in files_list:
|
154 |
files.append(os.path.join(root, file))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
|
156 |
-
if file_paths:
|
157 |
-
print("Go in normal paths")
|
158 |
-
files += [get_file(tmpsubdirpath, file_path) for file_path in file_paths]
|
159 |
|
160 |
print(f"Total number of files: {len(files)}")
|
161 |
for file_path in files:
|
|
|
142 |
else:
|
143 |
tmpsubdirpath = tmpdirname
|
144 |
|
145 |
+
if not partial_paths and not file_paths:
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
for root, _, files_list in os.walk(tmpdirname):
|
147 |
for file in files_list:
|
148 |
files.append(os.path.join(root, file))
|
149 |
+
else:
|
150 |
+
if partial_paths:
|
151 |
+
for partial_path in partial_paths:
|
152 |
+
files += get_all_files_in_folder(tmpsubdirpath, partial_path)
|
153 |
+
if file_paths:
|
154 |
+
files += [get_file(tmpsubdirpath, file_path) for file_path in file_paths]
|
155 |
+
else:
|
156 |
+
# Handle the case where either one is not empty
|
157 |
+
if partial_paths:
|
158 |
+
# partial_paths is not empty
|
159 |
+
print("Partial paths are not empty. Doing something...")
|
160 |
+
|
161 |
+
if file_paths:
|
162 |
+
# file_paths is not empty
|
163 |
+
print("File paths are not empty. Doing something...")
|
164 |
+
|
165 |
|
|
|
|
|
|
|
166 |
|
167 |
print(f"Total number of files: {len(files)}")
|
168 |
for file_path in files:
|