DIR - summary of size of subdirectories???

Jun 7, 2008
121
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
 
May 29, 2008
567
4
Groton, CT
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
4,448
88
Albuquerque, NM
prospero.unm.edu
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
 
May 20, 2008
3,515
4
Elkridge, MD, USA
----- 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
 
May 20, 2008
11,391
99
Syracuse, NY, USA
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
 
May 20, 2008
11,391
99
Syracuse, NY, USA
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!
 
May 20, 2008
3,515
4
Elkridge, MD, USA
----- 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
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,448
88
Albuquerque, NM
prospero.unm.edu
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.
 
May 20, 2008
11,391
99
Syracuse, NY, USA
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
 
May 20, 2008
3,515
4
Elkridge, MD, USA
----- 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
 
May 20, 2008
11,391
99
Syracuse, NY, USA
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
12,340
149
> 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
 
Similar threads
Thread starter Title Forum Replies Date
E Fixed Bug with DIR /Z displaying descriptions Support 8
J Paths shown in DIR /B Support 2
K Fixed Prompt display will be shifted after use dir to display a filename with Chinese. (v25.00.28 x64) Support 18
Jesse Heines How to? How to display picture creation date with dir command Support 6
vefatica WAD DIR.BTM? Support 11
DrusTheAxe DIR reports meaningless SYMLINK information Support 14
C show file description? with dir? Support 8
vefatica DIR /F and streams? Support 7
rps Multi-column DIR /v not displaying all files. Support 5
R How to? Dir specific file search patterns with spaces in the pathnames? Support 6
rps Dir /Nfv -> Alt-F2 Support 2
rps @FILESIZE[....,a] allocated size not matching Dir results Support 8
A TCMD - Dir Command puts out blank lines? Support 16
S Problems with dir command in the debugger Support 5
M TCC incorrect dir output since Windows 1803 Support 6
x13 Problem listing repository files using DIR http(s)://... Support 8
cxxl dir /s works in mysterious ways :( Support 4
vefatica Help nit (FFIND and DIR with /S) Support 0
N Fixed Strange dir behavior Support 6
JohnQSmith Weird DIR output (missing lines) Support 1
C 7zip with date range .vs. filelist created with dir and daterange Support 0
D Towards shared (dir-)history lists Support 3
vefatica WAD DIR /HL still gets names wrong Support 16
vefatica DIR /S /HL? Support 4
H Fixed DIR /G returns wrong sizes Support 2
nickles WAD dir.htm Support 2
vefatica DO dir in /s /a:+d /d"g:\" * ( ... ) Support 26
vefatica DIR \\.\...? Support 4
M Fixed DIR /S /B1 ignores "/S" Support 5
C tcmd.ini not loading from program dir? Support 5
D Fixed Dir /Nm:n has changed Support 1
rps How to? dir /s unexpected results Support 10
vefatica Update to current install dir? Support 8
cgunhouse Problem with "dir /=" Support 4
T dir /h error in empty directory Support 22
P WAD TC 15.0.1.58 x64 crasches with a simple dir command Support 18
CWBillow dir /4 strange Support 2
samintz WAD DIR /B1 and /X Support 2
nickles dir behaves inconsistently Support 5
vefatica DIR, streams, and wildcards? Support 1
vefatica DIR /: /u ... streams not counted? Support 7
vefatica Documentation DIR /B /S /: Support 2
samintz How to? DIR listing for exact match Support 1
dcantor WAD dir "ftp:// ..." fails in TCC 15 Support 7
T How to? dir/pdir - 2nd level down only Support 7
MikeBaas How to? DIR: supress extensions? Support 5
old coot dir /s dies on my C: drive Support 2
A WAD Dir daterange + multiple path wildcards crashes tcc Support 2
old coot TC DIR command has trouble on my SSD Support 2
M Fixed character set in dir/copy Support 3

Similar threads