ossobv / dutree Goto Github PK
View Code? Open in Web Editor NEWdutree (python lib/cli) helps quickly find which files/dirs are taking up space. Compare it with a summary of ncdu.
License: GNU General Public License v3.0
dutree (python lib/cli) helps quickly find which files/dirs are taking up space. Compare it with a summary of ncdu.
License: GNU General Public License v3.0
PermissionError: [Errno 13] Permission denied: '/./sys/kernel/debug'
$ sudo python dutree/dutree.py /
dutree/dutree.py:262: UserWarning: [Errno 2] No such file or directory: '/proc/14532/task/14532/fd/3'
warnings.warn(str(e))
dutree/dutree.py:262: UserWarning: [Errno 2] No such file or directory: '/proc/14532/task/14532/fdinfo/3'
warnings.warn(str(e))
dutree/dutree.py:262: UserWarning: [Errno 2] No such file or directory: '/proc/14532/fd/3'
warnings.warn(str(e))
dutree/dutree.py:262: UserWarning: [Errno 2] No such file or directory: '/proc/14532/fdinfo/3'
warnings.warn(str(e))
dutree/dutree.py:262: UserWarning: [Errno 13] Permission denied: '/run/user/1000/gvfs'
warnings.warn(str(e))
128.0 T /proc/kcore
17.0 G /*
-----
128.0 T TOTAL (140755721649795)
Should we blacklist /proc? Should we stay on the same filesystem? We might be able to use st_dev or st_rdev for this.
In the PlanB backup solution we bill the real (LZ4 compressed) size, but we list the apparent size. This can be confusing:
We should sum both and list both. Make the grouping optionally by apparent vs. by real size.
We should undo that ugliness.
/usr/local/lib/python3.5/dist-packages/dutree/dutree.py:291: UserWarning: [Errno 13] Permission denied: '/dev/.lxd-mounts'
warnings.warn(str(e))
Change to:
dutree.py:291: UserWarning: [Errno 13] Permission denied: '/dev/.lxd-mounts'
?
def _scan(self, path, parent_node):
fraction = self._subtotal // 20 # initialize fraction
children = [] # large separate child nodes
mixed_total = 0 # "rest of the dir", add to this node
try:
files = listdir(path or '/')
except OSError: # <--- here
# warn, and /sys/kernel/debug
files = []
for file_ in files:
755.0 M invoice/renderedinvoices/2012/
1.1 G invoice/renderedinvoices/2013/
1.5 G invoice/renderedinvoices/2014/
1.9 G invoice/renderedinvoices/2015/*
3.2 G invoice/renderedinvoices/2016/
4.2 G invoice/renderedinvoices/2017/*
1.1 G invoice/renderedinvoices/*
801.9 M invoice/*
-----
14.5 G TOTAL (15551665153)
See title.
And maybe also something that skips certain special filesystems: proc and sys?
(This will require adding a bit of argparse.)
If you want to find old/new versions of files, it is nice if we can show the min/max mtime for resultsets.
# dutree /somewhere
Traceback (most recent call last):
File "/usr/local/bin/dutree", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/dutree/dutree.py", line 331, in main
tree = scanner.scan()
File "/usr/local/lib/python2.7/dist-packages/dutree/dutree.py", line 230, in scan
self._tree, self._path, 0)
File "/usr/local/lib/python2.7/dist-packages/dutree/dutree.py", line 248, in _scan
st = lstat(fn)
OSError: [Errno 2] No such file or directory: '/somewhere/.pytree.py.4.swp'
Throws
AttributeError: 'os.stat_result' object has no attribute 'st_blocks'
instead
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.