17 lines
428 B
Bash
17 lines
428 B
Bash
|
|
||
|
module_load confirm
|
||
|
|
||
|
rm_node_modules () {
|
||
|
parent=${1:-$PWD}
|
||
|
echo finding node_modules folders within $parent
|
||
|
if command find . -name 'node_modules' -type d -prune 2>/dev/null;then
|
||
|
confirm continue with deleting? || return 1
|
||
|
command find . -name 'node_modules' -type d -prune -exec rm -r '{}' +
|
||
|
else
|
||
|
echo no folders to delete
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
|
||
|
# if script was executed then call the function
|
||
|
(return 0 2>/dev/null) || rm_node_modules $@
|