Issue: I wanted to count the number of subdirectories of a given directory.
Problem: Best described by two commands and their results:
As can be seen, the dot and double dot entries (the only entries in the "Sample" directory) are being counted. The For" command has a "/H(ide dots)" parameter for use when directories are explicitly included by using the "/A:" parameter with "+D" included as part of its value. However, I'm not finding an "equivalent" option for the "@Files" function. Is there a way to achieve this result other than a really ugly method of doing something like:
Or even:
For the "Sample" directory, both of the above code sections return 0, as they should.
By the way, as an aside I had a real problem with the above text within [CODE] and [/CODE] "sections" (or even [HTML] and [HTML] sections) being seriously "reformatted" in a very destructive way. I've figured out a way to work around the problem for now, but I consider it to be both ugly and stupid (if anybody's interested in it I have no problem with "sharing" it; but, again, I think that it is both ugly and stupid.) I tend to think that it is primarily the "<" and/or the ">" character(s), but I don't know that for sure. It seems to me that someone offered a solution to this problem in the past, but my recollection is both that it wasn't all that easy and that made it too complicated for me to remember given my often-mentioned bad memory. I couldn't find those postings, but again, I wasn't quite sure what to "search" for. If that was the "best" solution, can somebody "point to" where it is and I'll copy it off of this website to somewhere where I can find it in the future? Other than that, is there an "official" way to "work around" this problem?
Problem: Best described by two commands and their results:
Code:
[Z:\]dir Sample /K /M
11/09/2011 3:37 <DIR> .
11/09/2011 3:37 <DIR> ..
[Z:\]Echo %@Files[Sample]
2
Code:
[Z:\]UnsetArray /Q TreeList
[Z:\]SetArray TreeList[2048]
[Z:\]Echo %@ExecArray[TreeList, Tree C:\WinDDK] >NUL:
[Z:\]Echo %@Eval[%_ExecArray-2]
1929
[Z:\]UnsetArray /Q TreeList
Code:
[Z:\]Set Count=0
[Z:\]For /R C:\WinDDK /D %D in (*) do (Set Count=%@Inc[%Count])
[Z:\]Echo %Count
1929
By the way, as an aside I had a real problem with the above text within [CODE] and [/CODE] "sections" (or even [HTML] and [HTML] sections) being seriously "reformatted" in a very destructive way. I've figured out a way to work around the problem for now, but I consider it to be both ugly and stupid (if anybody's interested in it I have no problem with "sharing" it; but, again, I think that it is both ugly and stupid.) I tend to think that it is primarily the "<" and/or the ">" character(s), but I don't know that for sure. It seems to me that someone offered a solution to this problem in the past, but my recollection is both that it wasn't all that easy and that made it too complicated for me to remember given my often-mentioned bad memory. I couldn't find those postings, but again, I wasn't quite sure what to "search" for. If that was the "best" solution, can somebody "point to" where it is and I'll copy it off of this website to somewhere where I can find it in the future? Other than that, is there an "official" way to "work around" this problem?