From a9d2759b6ee9c533ecc81b4dd6418ea63451eb84 Mon Sep 17 00:00:00 2001 From: Nishant Srivastava Date: Thu, 20 Jun 2019 07:51:13 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20updated=20delete=20build=20direc?= =?UTF-8?q?tory=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- delete_build_folder.sh | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/delete_build_folder.sh b/delete_build_folder.sh index fc950e8..c1a85d7 100755 --- a/delete_build_folder.sh +++ b/delete_build_folder.sh @@ -7,13 +7,20 @@ # Install trash cli # brew install trash -# Iterate over each child directory inside the current directory -echo "" -for dir in ./*; +echo "# Deleting build directories..." + +# Iterate over each sub-directory inside the current directory +for DIR in ./*; do - echo "" - echo ">>>> Deleting build directory inside " $dir - trash $dir/build/ - echo "" - echo ">>>> Done." + # Check if build directory exists inside the $DIR directory + # If it does then it is a Flutter project + if [ -d "$DIR/build/" ]; then + # Update the packages in the project + echo "" + echo ">>>> Deleting build directory inside " "$DIR" + # Run command inside the sub-directory i.e Flutter project + (cd "$DIR" && trash build); + echo "" + echo ">>>> Done." + fi done