forked from rock-simulation/pybob
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrecursive_remove_build.py
More file actions
41 lines (32 loc) · 859 Bytes
/
recursive_remove_build.py
File metadata and controls
41 lines (32 loc) · 859 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
34
35
36
37
38
39
40
41
#!/usr/env python
import sys
import os
show = True
path = "."
if len(sys.argv) > 1:
if sys.argv[1] == "rm":
show = False
else:
path = sys.argv[1]
if len(sys.argv) > 2:
if sys.argv[2] == "rm":
show = False
def removeBuild(rootDir):
for root, dirs, files in os.walk(rootDir):
for d in dirs:
path = root + "/" + d
if d == "build":
cmd = ["rm", "-rf", path]
if show:
print(" ".join(cmd))
else:
os.system(" ".join(cmd))
def checkGits(rootDir):
for root, dirs, files in os.walk(rootDir):
for d in dirs:
path = root + "/" + d
if d == ".git":
cmd = ["du", "-hd0", path]
os.system(" ".join(cmd))
#checkGits(path)
removeBuild(path)