forked from OneUptime/oneuptime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremove-node-modules.sh
More file actions
29 lines (22 loc) · 790 Bytes
/
remove-node-modules.sh
File metadata and controls
29 lines (22 loc) · 790 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
#!/bin/bash
echo "Removing node_modules directories..."
# Remove node_modules in root directory first
if [ -d "node_modules" ]; then
echo "Removing node_modules in root directory"
rm -rf node_modules || echo "Failed to remove node_modules in root directory"
else
echo "No node_modules found in root directory"
fi
for d in */ ; do
if [ -d "$d" ]; then
cd "$d" || { echo "Cannot cd into $d"; continue; }
if [ -d "node_modules" ]; then
echo "Removing node_modules in $d"
rm -rf node_modules || echo "Failed to remove node_modules in $d"
else
echo "No node_modules found in $d"
fi
cd .. || echo "Cannot cd out of $d"
fi
done
echo "Finished removing node_modules directories."