2024-09-28 14:24:04 +08:00
|
|
|
|
|
|
|
import os
|
|
|
|
import shutil
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def clear(dir_path:str,rm_dir:str):
|
|
|
|
dir_list=os.listdir(dir_path)
|
|
|
|
for item in dir_list:
|
|
|
|
path=os.path.join(dir_path,item)
|
|
|
|
if os.path.isdir(path):
|
|
|
|
if item == rm_dir:
|
|
|
|
print('remove: ',path)
|
|
|
|
shutil.rmtree(path)
|
|
|
|
else:
|
|
|
|
clear(path,rm_dir)
|
2025-01-17 19:55:18 +08:00
|
|
|
elif os.path.isfile(path):
|
|
|
|
if item == rm_dir:
|
|
|
|
print('remove: ',path)
|
|
|
|
os.remove(path)
|
2024-09-28 14:24:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
clear('../','.output')
|
2025-01-17 19:55:18 +08:00
|
|
|
clear('../','src_files.txt')
|
2024-09-28 14:24:04 +08:00
|
|
|
|