Count files in DIR and place in varible.

Toshiba Satellite l505d-s5965 notebook
April 13, 2010 at 00:55:38
Specs: Windows 7, 1024
Whats the best way to count files in a directory along with subdir and place the count in a varible?

thanks
Brock


See More: Count files in DIR and place in varible.

Report •


#1
April 13, 2010 at 01:43:51
Not sure it's the 'best' way but untested:

@echo off
cls
setlocal enabledelayedexpansion

for /f "tokens=*" %%1 in ('dir /b/a-d/s foldername') do (
    set /anbr+=1
)
echo Files=!nbr!


Report •
Related Solutions


Ask Question