btdu icon indicating copy to clipboard operation
btdu copied to clipboard

Feature: keybinding to recompute the size of a directory

Open ArenM opened this issue 11 months ago • 1 comments

Motivation

When attempting to free disk space, I sometimes do things other than deleting files such as running git gc or compressing them. This makes the size listed in btdu inconsistent with the size on disk until btdu is restarted. Closing, reopening, and navigating back to the directory is an inefficient process.

Having a keybinding to recompute sizes for the current directory based on only new data would make this much easier. Ncdu uses the "r" key for this.

Implementation ideas / Speculation

I suspect refreshing a directory will require also refreshing anything that shares data with the directory.

Perhaps it would be easier to always refresh the root directory? This would be essentially the same as closing and restarting btdu, but would preserve the current directory.

Would it be possible to detect size changes by comparing a subset of most / least recent samples in a file / directory?

ArenM avatar Feb 05 '25 19:02 ArenM

I think the only way we could do that is if we threw away all samples, i.e. something like a "reset" key.

CyberShadow avatar Feb 05 '25 19:02 CyberShadow