Skip to content

Instantly share code, notes, and snippets.

@TyOverby
Last active February 29, 2024 08:17
Show Gist options
  • Save TyOverby/8a962541295c39da5250a083b782c19b to your computer and use it in GitHub Desktop.
Save TyOverby/8a962541295c39da5250a083b782c19b to your computer and use it in GitHub Desktop.
find . | grep "Cargo.toml$" | # Find all cargo.toml files \
sed 's#/[^/]*$##' | # Remove the filename leaving us with the directories containing cargo.toml files \
xargs -L1 printf "cd \"%s\"; cargo clean; cd -\n" | # Print "cd path/to/crate; cargo clean; cd -" \
bash # Execute
@max-lt
Copy link

max-lt commented Feb 29, 2024

Aternative without needing a script

find ~/Documents/projects -name Cargo.toml -type f -prune -exec echo "In {}" \; -exec cargo clean --manifest-path {} \;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment