-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrm_build_files.py
24 lines (20 loc) · 917 Bytes
/
rm_build_files.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import os
import shutil
def hesitant_destroyer():
# starting from here, because making decisions is hard
cwd = os.getcwd()
for root, dirs, files in os.walk(cwd, topdown=False):
for name in dirs:
if name == 'build':
full_path = os.path.join(root, name)
# asking for permission, because we're polite destructors
confirm = input(f"Poised to delete '{full_path}'. May I? (y/n): ")
if confirm.lower() == 'y':
# your wish is my command, oh flip-floppy one
shutil.rmtree(full_path)
print(f"Annihilated: {full_path}")
else:
# saved by the bell, or in this case, your indecision
print(f"Mercifully spared: {full_path}")
hesitant_destroyer()
print("The purging is complete. Or is it? Check your y/n reflexes.")