blob: b27b3e87b182ebdfbd707f5aff178451dd092b3d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#!/usr/bin/env python
#
# Logs deleter
#
from nsh import NSH
def main():
try:
logs_dir = "/fs/microsd/log"
nsh = NSH()
nsh.wait_and_open_nsh()
for file in nsh.get_all_files(logs_dir):
print("Removing file: {}{}".format(logs_dir, file))
nsh.exec_cmd("rm {}{}".format(logs_dir, file), 2.0)
for dir in nsh.get_all_dirs(logs_dir):
print("Removing dir: {}/{}".format(logs_dir, dir))
nsh.exec_cmd("rmdir {}/{}".format(logs_dir, dir[:-1]), 1.0)
print("Done.")
finally:
nsh.close()
if __name__ == "__main__":
main()
|