forked from clawpack/pyclaw
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcleanup_examples.py
More file actions
executable file
·35 lines (26 loc) · 925 Bytes
/
cleanup_examples.py
File metadata and controls
executable file
·35 lines (26 loc) · 925 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
#!/usr/bin/env python
r"""
Cleans up by deleting object files, executable, and _output directory.
"""
import os,sys,glob
import shutil
if __name__ == "__main__":
examples_dir = os.path.abspath('./examples')
print "Will remove all _output, _plots, and build directories from ",examples_dir
ans = raw_input("Ok? ")
if ans.lower() not in ['y','yes']:
print "Aborting."
sys.exit()
os.chdir(examples_dir)
exdirlist = []
for (dirpath, subdirs, files) in os.walk('.'):
currentdir = os.path.abspath(os.getcwd())
os.chdir(os.path.abspath(dirpath))
print 'In directory ',dirpath
if os.path.isdir('_output'):
shutil.rmtree('./_output')
if os.path.isdir('_plots'):
shutil.rmtree('./_plots')
if os.path.isdir('build'):
shutil.rmtree('./build')
os.chdir(currentdir)