How to check the count of .txt files in a folder (dir command)?

dir c:\temp\*.txt

This gives you a summary of the number of files matching that particular wildcard.

dir c:\temp\*.txt | find "File(s)"

If you only want to see the count and don't want to see any of the filenames.


If you need the count of files in a Batch variable for further processing, you may get it this way:

set i=0
for %%a in (*.txt) do set /a i+=1

After the for the i variable have the number of .txt files.


You can use the following. Once it has finished you'll see a summary with a count of the total matches:

dir *.txt /w /s