[Python-ideas] Suggestion: Add shutil.get_dir_size

Ram Rachum ram at rachum.com
Wed May 3 02:13:31 EDT 2017


Calling `du` is possible but I prefer to avoid these kinds of solutions.
(OS-specific, parsing text output from a third-party program.)

On Wed, May 3, 2017 at 1:57 AM, Cameron Simpson <cs at zip.com.au> wrote:

> On 02May2017 22:07, Ram Rachum <ram at rachum.com> wrote:
>
>> I have a suggestion: Add a function shutil.get_dir_size that gets the size
>> of a directory, including all the items inside it recursively. I currently
>> need this functionality and it looks like I'll have to write my own
>> function for it.
>>
>
> Feels like a rather niche function. Had you considered just calling "du"
> via subprocess and reading the number it returns?
>
> Cheers,
> Cameron Simpson <cs at zip.com.au>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170503/778a24e9/attachment.html>


More information about the Python-ideas mailing list