Skip to content

Instantly share code, notes, and snippets.

@MightyPork
Created March 2, 2021 17:37
Show Gist options
  • Save MightyPork/c510ddb7f9ee9cf1ac6c713cdb350dfa to your computer and use it in GitHub Desktop.
Save MightyPork/c510ddb7f9ee9cf1ac6c713cdb350dfa to your computer and use it in GitHub Desktop.
Run "cargo sweep" in all direct subfolders and report disk space saved
#!/bin/bash
before=$(du -bs | cut -d$'\t' -f1)
for d in $(ls -1); do
if [[ -e "$d/target" ]]; then
echo "------------ $d -------------"
cd "$d"
cargo sweep -i
cd ..
fi
done
after=$(du -bs | cut -d$'\t' -f1)
echo "Sweep done, before $before, after $after"
saved=$(echo "($before - $after)/1048576" | bc)
echo "Saved $saved MB"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment