26 lines
417 B
Python
26 lines
417 B
Python
|
|
||
|
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)
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
clear('../','.output')
|
||
|
|