1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

DIR - summary of size of subdirectories???

Discussion in 'Support' started by Stephen Howe, Jun 1, 2010.

  1. Stephen Howe

    Joined:
    Jun 7, 2008
    Messages:
    121
    Likes Received:
    0
    Hi, Using TCC 11.0048

    Is it possible to get a summary of the size of top-level subdirectories using DIR (or any other TCC command)?
    That means if I have

    M:\UserData
    M:\UserData\Sub1
    M:\UserData\Sub2
    M:\UserData\Sub3

    I am interested in the space Sub1 occupies (and all its subdirectories and files recursively) but I am not interested in listing any files or subdirectories below Sub1.

    This is so I can get an overview of where the space goes under
    M:\UserData

    I thought something like

    for /D %a in (*.*) do dir %a /s /u2 /K /M

    but I keep getting

    TCC: (Sys) The system cannot find the file specified.
    and 0 bytes

    How can I improve this?

    Thanks

    Stephen
     
  2. dcantor

    Joined:
    May 29, 2008
    Messages:
    507
    Likes Received:
    3
    Remove the /M .
     
  3. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,311
    Likes Received:
    39
    This may not be what you're looking for, but:

    Code:
    tree /h /z /s0 /a: M:\UserData
    
     
  4. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,869
    Likes Received:
    83
    The easiest solution is "tree /s0 /z". Lots of other ways depending on how
    complicated you want it to be ...

    Rex Conn
    JP Software
     
  5. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    ----- Original Message -----
    From: "Stephen Howe" <>
    To: <ESFabian@comcast.net>
    Sent: 2010. June 1., Tuesday 13.04
    Subject: [Support-t-2018] DIR - summary of size of subdirectories???


    | Hi, Using TCC 11.0048
    |
    | Is it possible to get a summary of the size of top-level subdirectories
    using DIR (or any other TCC command)?
    | That means if I have
    |
    | M:\UserData
    | M:\UserData\Sub1
    | M:\UserData\Sub2
    | M:\UserData\Sub3
    |
    | I am interested in the space Sub1 occupies (and all its subdirectories and
    files recursively) but I am not interested in listing any files or
    subdirectories below Sub1.
    |
    | This is so I can get an overview of where the space goes under
    | M:\UserData
    |
    | I thought something like
    |
    | for /D %a in (*.*) do dir %a /s /u2 /K /M
    |
    | but I keep getting
    |
    | TCC: (Sys) The system cannot find the file specified.
    | and 0 bytes
    |
    | How can I improve this?

    /m suppresses the report you want. Look up the recent /N option of DIR to
    suppress other undesirable items. The options ought to precede the filename
    as well.

    However, the @FILESIZE[] function might do a better job for you! Untested:

    for /d %a in (*) echo %@filesize[/s %a,bc,a] %a

    might do the job for you.
    --
    HTH, Steve
     
  6. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,970
    Likes Received:
    30
    On Tue, 01 Jun 2010 13:10:59 -0400, dcantor <> wrote:

    |Is it possible to get a summary of the size of top-level subdirectories using DIR (or any other TCC command)?

    4UTILS has @DU[]. It doesn't give the number of files (might change that today)
    but can use wildcards. It doesn't follow junctions.

    v:\> uhelp @du
    @DU[dir\[wild][,flag(s)]] = disk use; flags: R = recurse, A = allocated

    v:\> echo %@du[v:\]
    97178859

    v:\> echo %@du[v:\,r]
    154237626

    v:\> echo %@du[v:\,ra]
    158076928
    --
    - Vince
     
  7. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,970
    Likes Received:
    30
    It has probably been this way since the beginning of time, but I noticed that DIR's summary (even worse, that of DIR /S) counts "." and "..". This makes the directory count a little misleading! In the case of "DIR /S" that makes the directory count off by roughly a factor of 3! CMD does the same thing. ... compatibility? ... ugh!
     
  8. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    ----- Original Message -----
    From: "vefatica" <>
    To: <ESFabian@comcast.net>
    Sent: 2010. June 1., Tuesday 14.48
    Subject: RE: [Support-t-2018] Re: DIR - summary of size of subdirectories???


    | It has probably been this way since the beginning of time, but I noticed
    that DIR's summary (even worse, that of DIR /S) counts "." and "..". This
    makes the directory count a little misleading! In the case of "DIR /S" that
    makes the directory count off by roughly a factor of 3! CMD does the same
    thing. ... compatibility? ... ugh!

    Did you forget the /H option? It gives your desired result!
    --
    HTH, Steve
     
  9. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,311
    Likes Received:
    39
    But unlike CMD, Take Command's DIR has /H. Life is good.
     
  10. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,970
    Likes Received:
    30
    On Tue, 01 Jun 2010 15:00:49 -0400, Steve Fábián <> wrote:

    || It has probably been this way since the beginning of time, but I noticed
    |that DIR's summary (even worse, that of DIR /S) counts "." and "..". This
    |makes the directory count a little misleading! In the case of "DIR /S" that
    |makes the directory count off by roughly a factor of 3! CMD does the same
    |thing. ... compatibility? ... ugh!
    |
    |Did you forget the /H option? It gives your desired result!

    I know of it, and forgot it, but c'mon ... seeing/not seeing them and
    counting/not counting them are two different things.

    Saying my C drive has 11,736 directories when it actually has 3,912 is, as I
    said before, a little misleading. I can't imagine that anyone would want that.
    --
    - Vince
     
  11. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    ----- Original Message -----
    From: "vefatica" <>
    | I know of it, and forgot it, but c'mon ... seeing/not seeing them and
    | counting/not counting them are two different things.
    |
    | Saying my C drive has 11,736 directories when it actually has 3,912 is, as
    I
    | said before, a little misleading. I can't imagine that anyone would want
    that.

    Well, they are virtual directories, just like junctions and their
    logical extensions, symbolic directory links (not on my XP system). The
    issue is what do you want to count - directory entries with given
    attributes, or physical entities. If the latter, should files of size 0 be
    automatically excluded from file counts, too, having no actual file body?
    IMHO Rex provided the best approach, the option to suppress them if not
    wanted. Having a different default for counting and display would just
    confuse everyone. I have many aliases based on DIR, and they all include the
    /H option. Note that in PDIR it is already the default, just as you'd like
    it.
    OTOH, the concept of the . and .. directories has no business on a
    modern file system. I cannot think of a time when I explicitly utilized them
    as directories, except the dot . as shorthand for %_CWD, and occasionally
    the .. as a simpler way to specify the parent directory of %_CWD.
    --
    Steve
     
  12. Stephen Howe

    Joined:
    Jun 7, 2008
    Messages:
    121
    Likes Received:
    0
    That is perfect.
    Thanks Charles, Thanks everyone

    Stephen Howe
     
  13. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,970
    Likes Received:
    30
    On Tue, 01 Jun 2010 15:35:37 -0400, Steve Fábián <> wrote:

    | OTOH, the concept of the . and .. directories has no business on a
    |modern file system. I cannot think of a time when I explicitly utilized them
    |as directories, except the dot . as shorthand for %_CWD, and occasionally
    |the .. as a simpler way to specify the parent directory of %_CWD.

    A simpler way than what? The only generic alternative seems to be
    %@left[%@index[%_cwd,\,-1],%_cwd] (and that leaves something to be desired).

    And without "..", think of what the programmer would need to do to accomplish
    SetCurrentDirectory(L"..").

    There are probably deeper reasons (than convenience) for ".." in a file system.
    It would seem any node in a (file system) tree should contain a reference to the
    node above it. I'll bet there are some pretty fundamental reasons for "." too.
    --
    - Vince
     
  14. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,869
    Likes Received:
    83
    Compatibility.

    Rex Conn
    JP Software
     

Share This Page