Use os.makedirs(..., exist_ok=True)

This commit is contained in:
Aarni Koskela
2023-05-29 10:18:15 +03:00
parent 59419bd64a
commit 165ab44f03
6 changed files with 6 additions and 15 deletions

View File

@@ -95,8 +95,7 @@ def cleanup_models():
def move_files(src_path: str, dest_path: str, ext_filter: str = None):
try:
if not os.path.exists(dest_path):
os.makedirs(dest_path)
os.makedirs(dest_path, exist_ok=True)
if os.path.exists(src_path):
for file in os.listdir(src_path):
fullpath = os.path.join(src_path, file)