CFileList:Count


The Count method returns the number of files in the CFileList object. This is often useful as a loop counter when iterating over the file list.

Syntax

nFiles = CFindFiles:Count()

bullet.gif    nFiles is the number of files in the file list.

bullet.gif    Returns 0 if no files are found.

Example

The following script creates a CFileList object from the file named sFileName. Then it iterates through the file list, returning each name from the list. Note that Next returns the next file name as a string, so you should not hide its return value by using it as a loop counter.

F = new_filelist( sFileName )

-- Create a new CFileList from the file sFileName

while n = 1, F:Count() do

-- step through the file list

  str = F:Next()

-- save the next file name

  Printf("%s\r\n", str )

-- list the file name

  -- do something with the file name

 

end

 

Related Topics

CFileList, Start, Next


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.