Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need help with DOS command or script

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
I want ot quickly see the files and the number of files in a folder.
I have this code which works great for puting the names of files in notepad txt file
then I have code whihc counts files but it only counts them whereever the bat file is setting I want to mody this to count file in the folder I specify and also maybe put that number at the bottom of the text file.
Code:
dir "C:\Users\z533560\Documents\Time Reporting Validation\06_23_12 Newtech Timesheets\Voz" /b /on > "C:\Users\z533560\Desktop\TimesheetsFiles.txt"

notepad TimesheetsFiles.txt

set c=0
:TOP
for /f "tokens=1*" %%a in ('dir "C:\Users\z533560\Documents\Time Reporting Validation\06_23_12 Newtech Timesheets\Voz" /a * /b /s') do (
       call set /a c=%%c%%+1
)
ECHO %c% Files.
REM save the %c%  number to the bottom of the text file?

TIA

DougP
 
You could try substituting:
DIR %1

in the first line instead of using:
dir "C:\Users\z533560\Documents\Time Reporting Validation\06_23_12 Newtech Timesheets\Voz" /b /on > "C:\Users\z533560\Desktop\TimesheetsFiles.txt"

To add the counts to the end of the file, try this:

ECHO %c% Files >> TimesheetsFiles.txt
">>" says to append to the end of the file.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top