Skip to main content

quick and efficient disk usage scanner

Project description

dutree shows a summary of the directories/files which take up the most space.

Example usage:

$ dutree /srv

Annotated output, where only paths of >4G are shown:

12.1 G  /srv/data/audiofiles/
         ^-- audiofiles contains files/dirs with a total of 12.1G
             but it does NOT contain a single dir or file larger
             than 4G.
 4.3 G  /srv/data/callrecordings/unmatched/
 4.5 G  /srv/data/fax/
17.5 G  /srv/data/playlists/
34.4 G  /srv/data/twinfield_invoices/1/
 7.8 G  /srv/data/*
          ^-- data contains more files/directories than shown above
              but those that don't total above 4G are merged into
              this "leftover" node. That includes /twinfield_invoices/
              except for the /1/ subdirectory which already has its
              individual listing.
32   B  /srv/*
          ^-- there was only /data/ in /srv/, but the directory itself
              also takes up a tiny bit of space
 -----
80.6 G  TOTAL (86558511658)

NOTE: The directories do not count the size of themselves, only of their contents. This explains any discrepancies with du -sb output.

Library usage:

>>> from dutree import Scanner
>>> scanner = Scanner('/srv')
>>> tree = scanner.scan()
>>> tree.size()
86558511658

>>> len(tree.get_leaves())
7

>>> leaf0 = tree.get_leaves()[0]
>>> leaf0.name()
'/srv/data/audiofiles/'

>>> leaf0.size() / (1024.0 * 1024 * 1024)
12.092280263081193

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dutree-1.0.tar.gz (5.1 kB view details)

Uploaded Source

File details

Details for the file dutree-1.0.tar.gz.

File metadata

  • Download URL: dutree-1.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for dutree-1.0.tar.gz
Algorithm Hash digest
SHA256 31c7ab4b4fded99cb26f9e130acc825b058aa310dc290df734fcfaadcf1e6b3e
MD5 0d9a432008e905032c936aa7f4cd1b68
BLAKE2b-256 0ab65512ca1e176a8cf048acac5954e6f43e77e629b255b0616827578196359c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page