fix: fix the bug that if fail or success folder only has empty folders, it will also remove the fail or success folder.

This commit is contained in:
benjamin
2020-12-21 21:41:32 +08:00
parent 63b76d02b5
commit d29ad47f7b
2 changed files with 2 additions and 2 deletions

View File

@@ -59,7 +59,7 @@ def rm_empty_folder(path):
try: try:
files = os.listdir(path) # 获取路径下的子文件(夹)列表 files = os.listdir(path) # 获取路径下的子文件(夹)列表
for file in files: for file in files:
os.removedirs(path + '/' + file) # 删除这个空文件夹 os.rmdir(path + '/' + file) # 删除这个空文件夹
print('[+]Deleting empty folder', path + '/' + file) print('[+]Deleting empty folder', path + '/' + file)
except: except:
a = '' a = ''

View File

@@ -31,7 +31,7 @@ def escape_path(path, escape_literals: str): # Remove escape literals
def moveFailedFolder(filepath, failed_folder): def moveFailedFolder(filepath, failed_folder):
print('[-]Move to Failed output folder') print('[-]Move to Failed output folder')
shutil.move(filepath, str(os.getcwd()) + '/' + failed_folder + '/') shutil.move(filepath, str(os.getcwd()) + '/' + failed_folder + '/')
return return
def get_data_from_json(file_number, filepath, conf: config.Config): # 从JSON返回元数据 def get_data_from_json(file_number, filepath, conf: config.Config): # 从JSON返回元数据