Slack

An up-to-date version of this and other files can be found in my CommandLineTools project on GitHub.

Slack is a little program I wrote for myself. I wanted to know how much disk space was wasted because of cluster size.

Synopsis

slack [-h|-?] path

Description

A cluster is the smallest size you can allocate on a disk, and files always occupy one or more clusters. Even a one-byte file occupies an entire cluster, which can easily be 4k, 8k or larger. So on a file system with 4k cluster size, a one-byte file produces 4095 byte of slack. If you have many very small files, the slack can be rather high. Slack calculates the slack and displays it.

The program outputs the slack for the directory you specify and its subdirectories, as well as some other information. If you call slack without parameters, it will use the current directory.

Here you can see it in action, in my Windows directory (note that I use a German Windows, where . is the thousands separator, and , is the decimal separator — it may use a different output format on your system, according to your settings).:

Slack in action

If you want help, you can specify −h or −? as parameter.

Finally

I hope this code is useful to you. If you use some of it, please credit me. If you modify or improve the program, please send me the modifications.

I may improve or enhance slack myself, and I will try to post changes here. But this is not a promise. Please don’t request features.

Rudy Velthuis

Standard Disclaimer for External Links

These links are being provided as a convenience and for informational purposes only; they do not constitute an endorsement or an approval of any of the products, services or opinions of the corporation or organization or individual. I bear no responsibility for the accuracy, legality or content of the external site or for that of subsequent links. Contact the external site for answers to questions regarding its content.

Disclaimer and Copyright

The coding examples presented here are for illustration purposes only. The author takes no responsibility for end-user use. All content herein is copyrighted by Rudy Velthuis, and may not be reproduced in any form without the author's permission. Source code written by Rudy Velthuis presented as download is subject to the license in the files.

Back to top