On a Windows system, `dir /u $dirname` gives something like:
Volume in drive F is Work Serial number is 244F:5AF9 Directory of F:\dev\experiment\ScanWord\* 366,148 bytes in 5 files and 2 dirs 393,216 bytes allocated 4,040,884,224 bytes free
which can be parsed back in.

That's what I get using the 4NT 4.00A command shell; with COMMAND.COM and CMD.EXE results and actual flags to dir may be different.

In one application, I needed to know how much room a set of files would take up, before actually copying them to the target media (A CD-R). The filesystem of the staging area has different properties, so I couldn't just ask the filesystem, but had to compute it myself. Since I was already copying files over, it was easy to accumulate the size, rounding up to the sector size of the target.

—John


In reply to Re: Re: diskspace used by a directory by John M. Dlugosz
in thread diskspace used by a directory by c

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.