cleanup of list_all and delete_all
This commit is contained in:
parent
5673fe0337
commit
8f7d484559
1 changed files with 7 additions and 6 deletions
13
skratch.py
13
skratch.py
|
|
@ -11,10 +11,8 @@ def make_dir(d):
|
|||
os.mkdir(d)
|
||||
|
||||
def delete_all(d):
|
||||
if not os.path.exists(d):
|
||||
print("Skratch path doesn't exist")
|
||||
else:
|
||||
list_all(d)
|
||||
fc = list_all(d)
|
||||
if fc:
|
||||
x = input("Delete the above files? y/N ")
|
||||
if x.lower() == 'y':
|
||||
for file in os.listdir(d):
|
||||
|
|
@ -26,11 +24,14 @@ def delete_all(d):
|
|||
def list_all(d):
|
||||
if not os.path.exists(d):
|
||||
print("Skratch path doesn't exist")
|
||||
elif os.listdir(d) == []:
|
||||
return 0
|
||||
files = os.listdir(d)
|
||||
if files == []:
|
||||
print("No skratch files exist")
|
||||
else:
|
||||
for file in os.listdir(d):
|
||||
for file in files:
|
||||
print(file)
|
||||
return len(files)
|
||||
|
||||
def get_editor(use_v):
|
||||
v = os.getenv("VISUAL")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue