@FOLDERS[[/S[[+]n]] [range...] dirname[,[{+|-}]rhsadecijopt]] : Returns the number of folders (subdirectories) within range that match dirname and have the specified attributes. Returns 0 if no folders match. To check folders in multiple source directories use @FOLDERS once for each, and add the results with @EVAL.

 

Dirname must be in double quotes if it contains white space or special characters.

 

The range and attribute parameters, if included, define properties of the folders that will be included in the result as specified in File Selection. Multiple range parameters may be included, but not more than one each of description range, date range, and time range. Range parameters must precede dirname. Exclusion ranges are not supported.

 

If you include the optional /S argument, @FOLDERS will search the current directory and all of its subdirectories for matching folders. If you specify a number after the /S, @FOLDERS will limit the subdirectory recursion to that number. (For example, if you have a directory tree "\a\b\c\d\e", /S2 will only affect the "a", "b", and "c" directories.)

 

If you specify a + followed by a number after the /S, @FOLDERS will not count any folders until it gets to that depth in the subdirectory tree. For example, if you have a directory tree \a\b\c\d\e, /S+2 will not  count anything in \a or \a\b.

 

If you are searching for subdirectories (i.e., by specifying "d" in the attribute argument), @FOLDERS will not count the "." and ".." directory entries.

 

Example:

 

echo %@folders[c:\windows]

58

 

echo %@folders[/s,c:\windows]

17728