Skip to main content

Quickly find out which directories / files are hogging your disk space.

Project description

I used to work for Turner Broadcasting, and we used an internal perl script named sp to find files hogging disk space on a server. I have long ago left Turner, and never brought the source code along with me, so I decided to re-write it in python.

In a nutshell, here’s what it does:

  • Recurse through directories from a starting point (current working dir, or a directory you specify)

  • Gather all file sizes, and therefore, also directory sizes.

  • List all directories largest to smallest, and same for files.

  • Be able to ignore files less than a certain size while still letting their size count toward their parent directory’s size.

  • Be able to ignore directories less than a certain size while still letting their size count toward their parent directory’s size.

  • Limit number of files displayed per directory. For instance… Show only the top 15 largest files.

  • Limit depth to recurse.

Installation

sp uses setuptools for installation. It has no dependencies. sp is easy_installable:

$ easy_install sp

Alternatively, download and unpack the tarball and install:

$ tar zxf sp-1.0.2.tar.gz
$ python setup.py install

On UNIX systems, use sudo for the latter command if you need to install the scripts to a directory that requires root privileges:

$ sudo python setup.py install

The development git repository can be checked out anonymously:

$ git clone https://github.com/pthrasher/sp.git

There is one little tweak to the installation that you may want to consider. By default, setuptools installs scripts indirectly; the scripts installed to $prefix/bin or Python2xScripts use setuptools’ pkg_resources module to load the exact version of sp egg that installed the script, then runs the script’s main() function. This is not usually a bad feature, but it can add substantial startup overhead for a small command-line utility like sp. If you want the response of sp to be snappier, I recommend installing custom scripts that just import the sp module and run the sp_main() function. See the file examples/sp for an example.

Using sp

To recursively search from the current directory with default settings:

$ sp

To do anything else, see the help.

$ sp –help

To Do

  • Add file / folder exclusion list.

Bugs and Such

If you find a bug, or a missing feature you really want added, please post to the issue-tracker on github.com or email the author at <philipthrasher@gmail.com>.

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

sp-1.1.0.tar.gz (7.3 kB view hashes)

Uploaded Source

Supported by

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