How can use dir command to check how many .txt files there is in a folder (e.g C:\Temp)?

link|improve this question
Hi Jrara, you can mark Richard answer (dir c:\temp*.txt) as correct. – Larry Morries Oct 12 '11 at 8:31
feedback

2 Answers

up vote 5 down vote accepted
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.

link|improve this answer
feedback

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.