When I run a recursive directory search for files it outputs "File Not Found" if the folder is empty but echo %count% is outputting 0 like it should.
setlocal
set /a count=0
for /F %%N in ('dir/s/b/aa "folder\name\*.txt"^| find /c "::"') do set count=%%N
echo %count%
All I want is a batch file to count the number of text files recursively in a directory and output the result like 999 and show 0 if the folder is empty. I have tried many variations of >nul and tons of batch search scripts. I am out of unvisited Google links to look at anymore.