I have the command below to count all directories that that follow the pattern 20?????? :
20??????
\'dir /b \"20??????\" | find /c \"2\"\'
set cmd="dir /b "20??????" | find /c "2" " FOR /F "tokens=*" %%i IN (' %cmd% ') DO SET X=%%i