import os
import shutil
def delete_dir(root_path):
case_list = os.listdir(path= root_path)
case_list.sort()
for case in case_list:
print("case = {}".format(case))
get_subdir = os.listdir(os.path.join(root_path, case))
for sub_dir in get_subdir:
shutil.move(os.path.join(root_path, case, sub_dir), os.path.join(root_path, sub_dir))
os.rmdir(os.path.join(root_path, case))
if __name__ == '__main__':
root_path = r'F:\Hepatobiliary_surgery\test'
delete_dir(root_path)



