Skip to content

Instantly share code, notes, and snippets.

@cemo
Forked from jeroen-meijer/fluttercleanrecursive.sh
Created September 15, 2019 20:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cemo/72fd8dffbe0deb2d9b1c97c1ebfb0b57 to your computer and use it in GitHub Desktop.
Save cemo/72fd8dffbe0deb2d9b1c97c1ebfb0b57 to your computer and use it in GitHub Desktop.
Flutter Clean Recursive - Clear up space on your hard drive by cleaning your Flutter projects. This script searches for all Flutter projects in this directory and all subdirectories and runs 'flutter clean'. Note: may take a long time for folders with large amounts of projects.
#!/bin/sh
# To run, download the script or copy the code to a '.sh' file (for example 'fluttercleanrecursive.sh') and run like any other script:
# sh ./fluttercleanrecursive.sh
# or
# sudo sh fluttercleanrecursive.sh
echo "Flutter Clean Recursive (by jeroen-meijer on GitHub Gist)"
echo "Looking for projects... (may take a while)"
find . -name "pubspec.yaml" -exec $SHELL -c '
echo "Done. Cleaning all projects."
for i in "$@" ; do
DIR=$(dirname "${i}")
echo "Cleaning ${DIR}..."
(cd "$DIR" && flutter clean >/dev/null 2>&1)
done
echo "DONE!"
' {} +
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment