-
Notifications
You must be signed in to change notification settings - Fork 29
/
clean-it.sh
executable file
·48 lines (36 loc) · 1.97 KB
/
clean-it.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
#!/bin/bash
#
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# <floyd at floyd dot ch> wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return
# floyd http://floyd.ch @floyd_ch <floyd at floyd dot ch>
# July 2013
# ----------------------------------------------------------------------------
if [ $# -ne 1 ]
then
echo "Usage: `basename $0` dir-to-clean"
exit 0
fi
DIR=${1%/}
echo "#Cleaning $DIR"
echo "Don't care about .svn stuff"
find "$DIR" -type d -iname ".svn" -exec echo '#Removing {}' \; -exec rm -rf {} \;
echo "Don't care about .DS_Store files"
find "$DIR" -type f -name ".DS_Store" -exec echo '#Removing {}' \; -exec rm -rf {} \;
echo "Don't care about files ending in ~"
find "$DIR" -type f -iname "*~" -exec echo '#Removing {}' \; -exec rm -rf {} \;
echo "Don't care about directories called 'test' as the test code for Java code is located in there"
find "$DIR" -type d -name "test" -exec echo '#Removing {}' \; -exec rm -rf {} \;
echo "Don't care about directories called 'jars' as the jar dependencies for Java code is located in there very often, and we don't want to decompile all dependencies"
find "$DIR" -type d -name "jars" -exec echo '#Removing {}' \; -exec rm -rf {} \;
echo "Don't care about directories called 'samples'"
find "$DIR" -type d -name "samples" -exec echo '#Removing {}' \; -exec rm -rf {} \;
echo "Don't care about the gradle-wrapper.jar file (for deployment with gradle)"
find "$DIR" -type f -name "gradle-wrapper.jar" -exec echo '#Removing {}' \; -exec rm -rf {} \;
echo "Don't care about the Android R.java file (it's autogenerated)"
find "$DIR" -type f -name "R.java" -exec echo '#Removing {}' \; -exec rm -rf {} \;
#delete all empty files and directories
echo "Removing empty files/directories"
find "$DIR" -size 0 -exec echo '#Removing {}' \; -delete