added delete confirmation
This commit is contained in:
parent
13bd3e4703
commit
94e42cfe65
1 changed files with 8 additions and 5 deletions
13
skratch.py
13
skratch.py
|
|
@ -14,11 +14,14 @@ def delete_all(d):
|
|||
if not os.path.exists(d):
|
||||
print("Nothing to delete")
|
||||
else:
|
||||
for file in os.listdir(d):
|
||||
f = os.path.join(d,file)
|
||||
os.remove(f)
|
||||
print(f"removing: {f}")
|
||||
print("Done")
|
||||
list_all(d)
|
||||
x = input("Delete the above files? y/N ")
|
||||
if x.lower() == 'y':
|
||||
for file in os.listdir(d):
|
||||
f = os.path.join(d,file)
|
||||
os.remove(f)
|
||||
print(f"removing: {f}")
|
||||
print("Done")
|
||||
|
||||
def list_all(d):
|
||||
if not os.path.exists(d):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue