I have the command below to count all directories that that follow the pattern 20?????? :
20??????
\'dir /b \"20??????\" | find /c \"2\"\'
Here's a sample:
@echo off set wildcard=C:\*.* set count=0 FOR /F %%a in ('DIR /B %wildcard%') do set /A count=count+1 echo %count% files matching %wildcard% set choice= set /p choice=Press enter to continue ...