Created
September 15, 2019 13:00
-
-
Save jeroen-meijer/f4d86cca613519d08c698045ed881e12 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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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!" | |
' {} + |
Thank you. Just what I was looking for
Thanks for this. This script can be added as a Nix package (e.g. to environment.systemPackages
) like so:
(pkgs.writeScriptBin "fltr-clean-recursive"
(builtins.readFile "${fetchgit {
url = "https://gist.github.com/f4d86cca613519d08c698045ed881e12.git";
sha256 = "0r80cxmr80kbh1l7qc5g4pq6yys8a7nq4xsybfx1xc9d6h0i7gqn";
}}/fluttercleanrecursive.sh"))
this is beautiful!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is awesome. Thanks