File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ FOLDER=$1 ;
3
+
4
+ if [ $# -eq 0 ]
5
+ then
6
+ echo " No arguments were supplied so we will clean this folder: ${PWD} " ;
7
+ FOLDER=$( pwd) ;
8
+ fi
9
+
10
+
11
+ lines=$( find ${FOLDER} -name " node_modules" -type d -prune | wc -l)
12
+ if [ $lines -eq 0 ]; then
13
+ echo " \e[1mπ§Ή There is nothing to clean on the folder: ${FOLDER} " ;
14
+ return 0;
15
+ fi
16
+
17
+
18
+
19
+ echo " +=======================================================================+" ;
20
+ echo " |\t\t\t π FILES AFFECTED \t\t\t\t|" ;
21
+ echo " +=======================================================================+\n" ;
22
+ find ${FOLDER} -name " node_modules" -type d -prune -print0 | xargs -r -0 du -chs
23
+ echo " ========================================================================\n" ;
24
+ printf " π Would you like to erase this folders (y/n): "
25
+ read -r option
26
+ case $option in
27
+ ' y' |' Y' )
28
+ find ${FOLDER} -name " node_modules" -type d -prune -print0 | xargs -r -0 rm -rf
29
+ ;;
30
+ ' n' |' N' )
31
+ return 0;
32
+ ;;
33
+ * )
34
+ echo " β \e[1mInvalid option" ;
35
+ return 1;
36
+ ;;
37
+ esac
You canβt perform that action at this time.
0 commit comments