-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclean.sh
More file actions
executable file
·30 lines (23 loc) · 750 Bytes
/
clean.sh
File metadata and controls
executable file
·30 lines (23 loc) · 750 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
30
#!/bin/zsh
rootPath=$(pwd)
echo "🔍 Searching for all 'bin' and 'obj' folders under: \"$rootPath\" ..."
# Use `find` to get absolute paths to bin and obj folders
foldersToDelete=()
while IFS= read -r -d $'\0' folder; do
foldersToDelete+=("$folder")
done < <(find "$rootPath" \( -name bin -o -name obj \) -type d -print0)
if (( ${#foldersToDelete[@]} == 0 )); then
echo "✅ No 'bin' or 'obj' folders found."
exit 0
fi
echo "🧹 Found ${#foldersToDelete[@]} folders to delete."
for folder in "${foldersToDelete[@]}"; do
echo "🗑️ Deleting folder: $folder"
rm -rf "$folder"
if [[ ! -d "$folder" ]]; then
echo "✔️ Deleted: $folder"
else
echo "❌ Failed to delete: $folder"
fi
done
echo "✅ Cleanup complete."