Skip to content

Commit 73a4a19

Browse files
committed
updated bash script to delete build folders
1 parent 034178d commit 73a4a19

File tree

1 file changed

+27
-15
lines changed

1 file changed

+27
-15
lines changed

delete_build_folder.sh

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,38 @@
1-
#!/bin/bash
2-
# Written by Nishant Srivastava
1+
#!/usr/bin/env bash
32

3+
# Copyright 2018 Nishant Srivastava
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
# ______________________________________________________________________
17+
# Dependency: trash cli tool
18+
# >> Install: brew install trash
19+
#
420
# Call as
521
# ./delete_build_folder.sh
22+
# ______________________________________________________________________
623

7-
# Install trash cli
8-
# brew install trash
9-
10-
echo "# Deleting build directories..."
24+
echo " 🗑 Deleting build directories..."
1125

1226
# Iterate over each sub-directory inside the current directory
1327
for DIR in ./*;
1428
do
1529
# Check if build directory exists inside the $DIR directory
16-
# If it does then it is a Flutter project
17-
if [ -d "$DIR/build/" ]; then
18-
# Update the packages in the project
19-
echo ""
20-
echo ">>>> Deleting build directory inside " "$DIR"
21-
# Run command inside the sub-directory i.e Flutter project
22-
(cd "$DIR" && trash build);
23-
echo ""
24-
echo ">>>> Done."
30+
BUILD_DIR="$DIR/build/"
31+
if [ -d $BUILD_DIR ]; then
32+
echo " > Deleting build directory inside " "$DIR"
33+
# Run the trash command on build directory
34+
trash $BUILD_DIR
2535
fi
2636
done
37+
38+
echo " ✔️ Done."

0 commit comments

Comments
 (0)