feat(clean): report size of removed files#6053
Merged
ruben-arts merged 2 commits intoMay 11, 2026
Merged
Conversation
`pixi clean` and `pixi clean cache` now print the human-readable size of each removed folder/file and a final total, so users can see how much disk space was reclaimed.
Avoids the extra pre-walk to compute folder size: the recursive removal now sums file sizes as it deletes, returning the total (or partial total on error). The simple spinner showing the directory currently being cleaned is unchanged.
Contributor
Author
|
@ruben-arts This is ready |
Contributor
|
I did a similar test as in this PR: #5218 It's a non significant slowdown but I'm not sure what the change would be if the cache was even larger. Do you think the UX improvement is more important than speed? |
Contributor
Author
|
I can deep dive what is causing that but I assume the extra stat calls. I do think showing how much is actually removed (barring links) is much better yes! |
Member
|
@ruben-arts just to be sure, did you compile in |
ruben-arts
approved these changes
May 11, 2026
Contributor
I did, |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
pixi cleanis now a tiny bit more rewarding: it tells you how much disk space you just liberated. Because "removed your environments" hits different when followed by "(4.2 GiB)".The recursive deletion now sums file sizes as it goes. Each folder gets its own
Removed <path> (<size>)line and the run ends with a boldRemoved <total>summary.Works for
pixi clean,pixi clean --environment,pixi clean cache, and friends.How Has This Been Tested?
cargo check -p pixi_clicargo clippy -p pixi_cli --all-targets -- -D warningscargo fmt --all -- --checkpixi cleanandpixi clean cacheon a real workspace,watched the spinner spin and the bytes add up.
AI Disclosure
Tools: Claude
Checklist: