|
Answer» Hi All,
Can anyone help me on a Batch file code that would count a specific filename ?
I already know how to count number of files within a folder but i dont know how to incorporate it on a specific filename.
echo off for /F %%A in ('dir ^| find "File(s)"') do set cnt=%%A
Sample Filename EGRHI-Tenant1-01061219.csv = 061219 is the date of the sales file (not the date of the day)
something like count all files ??-???-??06??19.csv
I need to count all files on a monthly basis for EXAMPLE how many files on 0619.
If theres a BLANK that would ask me what month and year the better.
Many thanks Anyone ?There is no error checking for two digit responses to the prompts, but ILL leave that to you.
Code: [Select]echo off set /p mm=Enter Month: set /p yy=Enter Year: for /f %%A in ('dir *%mm%??%yy%.csv ^| find "File(s)"') do set cnt=%%A echo %cnt%
You can REMOVE the last line. It was used it for testing.
Happy Coding
|