Created
September 4, 2024 10:00
-
-
Save ronaldwolvers/4e7a98a692a4717723ece7c5400a0e65 to your computer and use it in GitHub Desktop.
Remove build subdirectories in Bash/ZSH (POSIX compliant)
This file contains hidden or 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/bash | |
| # Delete all directories that are called 'build' in the directory from where this script | |
| # is invoked. | |
| echo -e "Removing all 'build' subdirectories..." | |
| # According to https://github.com/koalaman/shellcheck/wiki/SC2038 whitespaces are interpreted | |
| # by xargs in an unsafe way, therefore -print0 was added to `find` and -0 to `xargs`. | |
| #find . -name "build" -type d | xargs -t -I {} rm -rf {} | |
| find . -name "build" -type d -print0 | xargs -0 -t -I {} rm -rf {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment