1
0
mirror of https://github.com/Escartem/AnimeWwise.git synced 2026-06-23 12:40:47 +08:00

don't create folder if empty

This commit is contained in:
Escartem
2023-10-04 20:28:14 +02:00
parent b533958797
commit a3341e922b

View File

@@ -252,7 +252,9 @@ def main():
# prepare folders # prepare folders
os.makedirs(path(f"output/{filename}"), exist_ok=True) os.makedirs(path(f"output/{filename}"), exist_ok=True)
if len(new_files) > 0:
os.makedirs(path("temp/new_files"), exist_ok=True) os.makedirs(path("temp/new_files"), exist_ok=True)
if len(changed_files) > 0:
os.makedirs(path("temp/changed_files"), exist_ok=True) os.makedirs(path("temp/changed_files"), exist_ok=True)
# split files into corresponding folder # split files into corresponding folder
@@ -264,7 +266,9 @@ def main():
# move them to output # move them to output
final_path = f"output/{filename}" final_path = f"output/{filename}"
if len(new_files) > 0:
shutil.move("temp/new_files", f"{final_path}/new_files") shutil.move("temp/new_files", f"{final_path}/new_files")
if len(changed_files) > 0:
shutil.move("temp/changed_files", f"{final_path}/changed_files") shutil.move("temp/changed_files", f"{final_path}/changed_files")
# cleanup # cleanup