Search found 6 matches
- 11 Oct 2012 14:32
- Forum: DOS Batch Forum
- Topic: counting .bin files in a folder
- Replies: 13
- Views: 7697
Re: counting .bin files in a folder
Ed, I tried without token and /f and you were correct, it works without them fine.
- 04 Oct 2012 11:45
- Forum: DOS Batch Forum
- Topic: counting .bin files in a folder
- Replies: 13
- Views: 7697
Re: counting .bin files in a folder
set count=0
for /f "tokens=* delims=" %%i in ('Dir /B /A:-D "Query.*.bin"') do set /a count+=1
for /f "tokens=* delims=" %%i in ('Dir /B /A:-D "Query.*.bin"') do set /a count+=1
- 04 Oct 2012 09:13
- Forum: DOS Batch Forum
- Topic: counting .bin files in a folder
- Replies: 13
- Views: 7697
Re: counting .bin files in a folder
Thank you guys! All fixed 

- 02 Oct 2012 14:16
- Forum: DOS Batch Forum
- Topic: counting .bin files in a folder
- Replies: 13
- Views: 7697
Re: counting .bin files in a folder
This is my revised code
set pattern=Query.*.bin
for /f "tokens=* delims=" %%i in ('Dir /B /A:-D %pattern%') do set /a count+=1
echo There is %count% .bin File(s)
set pattern=Query.*.bin
for /f "tokens=* delims=" %%i in ('Dir /B /A:-D %pattern%') do set /a count+=1
echo There is %count% .bin File(s)
- 02 Oct 2012 14:02
- Forum: DOS Batch Forum
- Topic: counting .bin files in a folder
- Replies: 13
- Views: 7697
Re: counting .bin files in a folder
I did what you suggested and I got the correct answer, the only problem I have now is that when I rerun it, it gives me again zero. For some reason it only works one time and then cannot count again.
- 02 Oct 2012 11:25
- Forum: DOS Batch Forum
- Topic: counting .bin files in a folder
- Replies: 13
- Views: 7697
counting .bin files in a folder
Hello, I am trying to count the number of .bin files in my folder that include a particular name pattern. I basically need to count how many such files I have for each name type. For instance in my folder I have files like Query.1.bin Query.2.bin Query.3.bin and the response should be 3. I have set ...