user2281858
user2281858

Reputation: 1997

Find total number of files in a sub-folder in windows 7

I am trying to count the total number of jpeg files located in a folder.

I tried the following:

dir|find /e ".jpeg"

But it returned the following error.

FIND: Invalid switch

I am using Windows-7 64 bit.
Please help.

Upvotes: 1

Views: 1349

Answers (3)

bman
bman

Reputation: 5235

The command dir gives you the count of files at the bottom:

dir *.jpeg

But if you want to do it in a batch file, you can try this:

set count=0 & for %%x in (*.jpg) do @(set /a count+=1 >nul)
echo %count%

Upvotes: 1

npocmaka
npocmaka

Reputation: 57252

Will work if the language settings are in Enlish.For the prompt:

 for /f  %a in ('dir /a:-d "*.jpeg"^|find /i "file(s)"') do echo %a

For bat file use:

for /f  %%a in ('dir /a:-d "*.jpeg"^|find /i "file(s)"') do set count=%%a
echo %count%

Upvotes: 1

Endoro
Endoro

Reputation: 37569

Try this:

Dir /b /a-d *.jpeg | find /c ".jpeg"

http://ss64.com/nt/find.html

Upvotes: 2

Related Questions