forked from fastmachinelearning/hls4ml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcleanup.sh
executable file
·64 lines (53 loc) · 1.02 KB
/
cleanup.sh
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
failed=0
basedir=vivado_prj
all=0
function print_usage {
echo "Usage: `basename $0` [OPTION]"
echo ""
echo "Cleans up the projects in provided directory."
echo ""
echo "Options are:"
echo " -d DIR"
echo " Base directory where projects are located."
echo " -a"
echo " Remove all projects, even the failed ones."
echo " -h"
echo " Prints this help message."
}
while getopts ":d:ah" opt; do
case "$opt" in
d) basedir=$OPTARG
;;
a) all=1
;;
h)
print_usage
exit
;;
esac
done
if [ ! -d "${basedir}" ]; then
echo "Specified directory '${basedir}' does not exist."
exit 1
fi
if [ "${all}" -eq 1 ]; then
rm -rf "${basedir}"
exit $?
fi
#rundir=`pwd`
cd "${basedir}"
rm -f *.tar.gz
# Delete
for dir in */ ; do
if [ ! -f "${dir}BUILD_FAILED" ]; then
rm -rf "${dir}"
if [ $? -eq 0 ]; then
echo "Removed ${dir%/}."
else
failed=1
fi
fi
done
#cd "${rundir}"
exit ${failed}