WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

File Operations

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

File Counting and Item Counting Loop

Keywords:  file count counter  

Question:

How do I set up a file counter in a WinBatch Script?

Answer:

Code to replace the following DOS command:
>>> FOR %%J in (C:\*.EXE)  DO ECHO %%J
First you'll itemize all the EXE files in your root directory, and then do an itemcount on them.
List = FileItemize("C:\*.EXE")        ; get file list
FileCount=ItemCount( List, @TAB)      ; TAB for file list delimiter
for FileIndex = 1 to FileCount
         ThisFile= ItemExtract( FileIndex, List, @TAB)
         Message(FileCount, ThisFile)
next  

Article ID:   W14591
Filename:   File Counting and Item Counting Loop.txt
File Created: 2001:01:03:10:09:54
Last Updated: 2001:01:03:10:09:54