-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclean
More file actions
executable file
·44 lines (36 loc) · 1.49 KB
/
clean
File metadata and controls
executable file
·44 lines (36 loc) · 1.49 KB
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
#!/bin/bash
# Define the directories to clean
DIRECTORIES=("./" "./Sandbox" "./Engine")
# Define the files and directories to remove
# These are common files and folders generated by CMake
REMOVE_TARGETS=("CMakeCache.txt" "CMakeFiles" "cmake_install.cmake" "Makefile" "build" "bin" "lib" "install")
# A counter to track if anything was removed
CLEANED_SOMETHING=0
echo "Starting CMake cleanup process..."
# Loop through each specified directory
for dir in "${DIRECTORIES[@]}"; do
# Check if the directory exists and is a directory
if [ -d "$dir" ]; then
echo "Searching for files in: $dir"
# Loop through each target to remove
for target in "${REMOVE_TARGETS[@]}"; do
# Use find to locate and remove the target
# -maxdepth 1 ensures we only search the current directory and not its subdirectories
# -exec rm -rf {} \; executes a remove command on the found file/directory
find "$dir" -maxdepth 1 -name "$target" -exec rm -rf {} + 2>/dev/null
# Check if find was successful (an item was found and removed)
if [ $? -eq 0 ]; then
echo " - Removed $dir/$target"
CLEANED_SOMETHING=1
fi
done
else
echo "Warning: Directory not found: $dir"
fi
done
echo "Cleanup complete."
if [ $CLEANED_SOMETHING -eq 0 ]; then
echo "No CMake files or directories were found to remove."
else
echo "Successfully removed specified CMake build artifacts."
fi