. and .. directories counted by @files function

May 24, 2010
855
0
Northlake, Il
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
229
1
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?
>
 
May 20, 2008
3,515
4
Elkridge, MD, USA
---- 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
 
May 24, 2010
855
0
Northlake, Il
---- 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,503
16
Solon, OH, USA
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?
 
Similar threads
Thread starter Title Forum Replies Date
gworley Virtual network drive filename completion doesn’t get directories Support 0
thorntonpg sync /S /F creating empty directories Support 5
WadeHatler pdir broken in 19.1 for directories with spaces Support 1
P Color directories in Win10 build 10586 console Support 11
R How to? Name completion only of directories? Support 3
fromano How to? Everything finding directories with 2 or more files in them Support 3
M Problem with Extended Search and non-ASCII characters in directories names Support 3
R How to? Is there a way to see current directories in all drives? Support 11
J rmdir /s recurses into symlinkd directories Support 4
D ffind and directories Support 2
S Listing the paths of all directories of a given name Support 4
thedave Newly created directories missing from TCMD Support 0
S GPF after successfully renaming directories on an ftp server Support 2
nikbackm Sorting (DIR) over sub-directories Support 3
p.f.moore Compare 2 directories Support 8
S DEL unhides directories Support 9
vefatica Modifying a counted DO loop's counter? Support 1
L alternate streams size not counted Support 7
nikbackm FOR vs DO for counted loops Support 9
vefatica DIR /: /u ... streams not counted? Support 7
MickeyF TCC crashing when copying multiple files (now resolved) Support 6
fpefpe How to? shortcuts and batch files Support 4
C v28 key files Support 2
J ffind does not find files Support 4
C duplicate files in multiple plugin sites Support 9
Dmitry L. Kobyakov Fixed The SETARRAY /R command works incorrectly with cyrillic files Support 2
S How to? Deinstalling TC/reinstating execution of bat files by cmd in Win7 Support 31
vefatica FFIND, temp files? ... not deleted? Support 0
R FUNCTION to count NUMBER of files matching a pattern and specific length/not length Support 4
vefatica Tmp files from in-process pipes not deleted Support 6
vefatica Finding files with alternate data streams? Support 4
rps Multi-column DIR /v not displaying all files. Support 5
D How to skip files in a fileset? Support 6
vefatica PIPEVIEW leaves TMP files Support 18
K "copy /z /w" command not deleting read-only files in destination Support 10
Jesse Heines "Taken" date for JPG and PNG files Support 4
O I cannot use links to .btm files Support 5
C How to? rename files with spaces Support 8
R How to? Append files in multiple subfolders using copy? Support 8
Joe Caverly "Functions" in cmd.exe batch files Support 6
S Batch files Calling Batch Files Support 2
vefatica Find Files/Text dialog: does it work? Support 0
Joe Caverly UNZIPping older .ZIP files Support 3
C Documentation default location for LOG files Support 21
P exit /b in batch files Support 7
P Labels in batch files: TCC vs CMD.exe Support 9
M ANSI is used to show files instead of OEM in version 17 to 19 ! Support 5
C 7Z files on forum? Support 0
x13 Problem listing repository files using DIR http(s)://... Support 8
B Can copy command concatenate multiple mp3 files Support 2

Similar threads