-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeleteScript.py
More file actions
33 lines (27 loc) · 827 Bytes
/
deleteScript.py
File metadata and controls
33 lines (27 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""
a Simple script that deletes all PNG files in the directory
Used to clean out directories while testing the Radio Plotting Script
2024/01/26 Resbi & RJGamesAhoy
"""
import os, sys
def deleteFiles(fileList):
for file in fileList:
os.remove(os.getcwd() + '/Output/' + file)
return
def scanForPng():
toDelete = []
currentDirectory = str(os.getcwd())
for file in os.listdir(currentDirectory + '/Output/'):
if ".png" in file:
toDelete.append(file)
if toDelete == []:
print("There are no PNG's in this Directory\nExiting")
sys.exit(0)
return toDelete
def main():
print("Deleting all PNG files in " + str(os.getcwd() + '/Output/'))
filesToDelete = scanForPng()
deleteFiles(filesToDelete)
print("All Done!")
return
main()