. and .. directories counted by @files function

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
#1
I simply want to count the number of subdirectories that exist below a particular directory in a directory tree. "%@Files[/S "%D",+d]" almost works except that it also counts the dot and double-dot directories in the tree, and I can't, as far as I can tell, compensate for them using the @Eval function (if it can be done that way, the math is too complicated for me to figure out right now!). Is there any way to do this, or Rex could you please add this capability to the @Files function (similar to the /H operand on the dir command and the default for the pdir command) at some point in the future?
 
Aug 9, 2009
133
0
#2
try this mathewsdw

dir /b /a:+d | (echo %@lines[con])


> -----Original Message-----
> From: mathewsdw [mailto:]
> Sent: Monday, 7 March 2011 12:41 a.m.
> Subject: [Support-t-2652] . and .. directories counted by @files
> function
>
>
> I simply want to count the number of subdirectories that exist below
> a particular directory in a directory tree. "%@Files[/S "%D",+d]"
> *almost* works except that it *also* counts the dot and double-dot
> directories in the tree, and I can't, as far as I can tell,
> compensate for them using the @Eval function (if it can be done that
> way, the math is too complicated for me to figure out right now!). Is
> there any way to do this, or Rex could you please add this capability
> to the @Files function (similar to the /H operand on the dir command
> and the default for the pdir command) at some point in the future?
>
 
#3
---- Original Message ----
From: mathewsdw
To: ESFabian@zenge.org
Sent: Sunday, 2011. March 6. 06:41
Subject: [Support-t-2652] . and .. directories counted by @files
function

| I simply want to count the number of subdirectories that exist below
| a particular directory in a directory tree. "%@Files[/S "%D",+d]"
| almost works except that it also counts the dot and double-dot
| directories in the tree, and I can't, as far as I can tell,
| compensate for them using the @Eval function (if it can be done that
| way, the math is too complicated for me to figure out right now!). Is
| there any way to do this, or Rex could you please add this capability
| to the @Files function (similar to the /H operand on the dir command
| and the default for the pdir command) at some point in the future?

Try "%@Files[/S "%D",d]" - this variant invocation on my system always returns the same count as the directory count in the command, and manually verified not to include the . and .. directories:

*dir/s/a:d/u2/h
--
HTH, Steve
 
#4
---- Original Message ----
From: mathewsdw
To: ESFabian@zenge.org
Sent: Sunday, 2011. March 6. 06:41
Subject: [Support-t-2652] . and .. directories counted by @files
function

Try "%@Files[/S "%D",d]" - this variant invocation on my system always returns the same count as the directory count in the command, and manually verified not to include the . and .. directories:

*dir/s/a:d/u2/h
--
HTH, Steve
Steve,

Thank you, but that is exactly what I was doing so it was a real mystery to me until I thought about it some more. The problem turned out to be that there were a number of "hidden" directories in the directory tree that @Files was counting and I had completely forgotten about. I may be getting older but that doesn't mean I'm getting wiser...
 

samintz

Scott Mintz
May 20, 2008
1,203
11
Solon, OH, USA
#6
After some experimentation I found that
I get different results depending on whether /S is specified or not. It
seems that when /S is *not* specified the dot directories get counted.
But if it *is* specified they do not get counted.

Also /S0 counts the dot directories,
but /S1 does not.

-Scott

mathewsdw <> wrote on 03/06/2011
06:41:17 AM:


> mathewsdw <>
> 03/06/2011 06:41 AM
>
> Please respond to
>
>
> To
>
> Samintz@ra.rockwell.com
>
> cc
>
> Subject
>
> [Support-t-2652] . and .. directories counted by @files function
>
> I simply want to count the number of subdirectories that exist below
> a particular directory in a directory tree. "%@Files[/S
"%D",+d]"

> *almost* works except that it *also* counts the dot and double-dot

> directories in the tree, and I can't, as far as I can tell,
> compensate for them using the @Eval function (if it can be done that
> way, the math is too complicated for me to figure out right now!).

> Is there any way to do this, or Rex could you please add this
> capability to the @Files function (similar to the /H operand on the

> dir command and the default for the pdir command) at some point in
the future?