Last active
December 18, 2025 06:45
-
-
Save eliascotto/1e050638ba1e4a7a8352fd2a5cca07e6 to your computer and use it in GitHub Desktop.
Remove artifacts from the all the cargo target directories in a subdirectory
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 | |
| # Check if a folder was passed as an argument | |
| if [ -z "$1" ]; then | |
| echo "Usage: $0 <path-to-folder>" | |
| exit 1 | |
| fi | |
| # Absolute path of the base directory | |
| BASE_DIR="$1" | |
| # Find all directories containing Cargo.toml and run cargo clean in them | |
| find "$BASE_DIR" -type f -name "Cargo.toml" | while read -r file; do | |
| DIR="$(dirname "$file")" | |
| echo "Running 'cargo clean' in: $DIR" | |
| (cd "$DIR" && cargo clean) | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment