DIR - summary of size of subdirectories???

Jun 7, 2008
121
0
#1
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
 
May 29, 2008
532
3
Groton, CT
#2
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
Remove the /M .
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,599
46
Albuquerque, NM
prospero.unm.edu
#3
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?
This may not be what you're looking for, but:

Code:
tree /h /z /s0 /a: M:\UserData
 
#5
----- Original Message -----
From: "Stephen Howe" <>
To: <[email protected]>
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
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
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
----- Original Message -----
From: "vefatica" <>
To: <[email protected]>
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
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,599
46
Albuquerque, NM
prospero.unm.edu
#9
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!
But unlike CMD, Take Command's DIR has /H. Life is good.
 
#10
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
----- 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
 
#13
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
 

rconn

Administrator
Staff member
May 14, 2008
10,551
97
#14
> 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!
Compatibility.

Rex Conn
JP Software