From 9e742c56552813a33b79c97a04b32f6826668620 Mon Sep 17 00:00:00 2001 From: Nishant Srivastava Date: Fri, 29 Nov 2019 03:21:55 +0100 Subject: [PATCH] updated bash script to delete build folders --- delete_build_folder.sh | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/delete_build_folder.sh b/delete_build_folder.sh index 9bd6441..a843fa4 100755 --- a/delete_build_folder.sh +++ b/delete_build_folder.sh @@ -23,16 +23,11 @@ echo " 🗑 Deleting build directories..." -# Iterate over each sub-directory inside the current directory -for DIR in ./*; +# Find all directories with name "build" inside the current directory, recursively +for FOUND_BUILD_DIR in $(find . -type d -name "build"); do - # Check if build directory exists inside the $DIR directory - BUILD_DIR="$DIR/build/" - if [ -d $BUILD_DIR ]; then - echo " > Deleting build directory inside " "$DIR" - # Run the trash command on build directory - trash $BUILD_DIR - fi + # Run the trash command on found build directory + trash $FOUND_BUILD_DIR done echo " ✔️ Done."