@FILES[[/S[[+]n]] [range...][/H] filename[,[{+|-}]rhsadecijopt]] : Returns the number of files within range that match filename and have the specified attributes. Filename may contain wildcards and include lists. Returns 0 if no files match. To check files in multiple directories use @FILES once for each, and add the results with @EVAL.


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


The range and attribute parameters, if included, define properties of the files 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, size range, date range, and time range. Range parameters must precede filename. Exclusion ranges are not supported.


If you include the optional /S argument, @FILES will search the current directory and all of its subdirectories for matching files. If you specify a number after the /S, @FILES 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, @FILES will not count any files 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 include the optional /H argument, @FILES will not include the "." and ".." directory entries in the count.




echo %@files[/[s2k,3k] *.txt]

 number of files with extension txt in the current directory with size at least 2000 bytes and at most 3000 bytes


echo %@files[*,d]

 number of subdirectories


echo %@files[/[d-365] %windir\w*.exe;w*.dll]

 number of files at most 365 days old in the Windows directory, with extension EXE or DLL, and name beginning with w