CFileList:new
The new method creates an instance of the CFileList class. You must call new before using any class methods or properties. Note that this object can also be created using the new_filelist function. Use the Next method to iterate over the file list, fetching the names of each file from the list.
F = CFileList:new() Creates a new object. Using this constructor, you must call Open before fetching files from the filelist. F = CFileList:new( sFileName ) Creates a new CFileList object and opens the file list from sFileName. The file name must include a complete path specification. F = CFileList:new( CFileList_Object ) Creates a new CFileList object by copying the properties of the existing CFileList_Object. |
Three overloads are provided for this method. If you use the default constructor with no arguments, then Open must be called to open the file list from a file. If the file name is specified, the file list is opened and set to the beginning of the file. If another CFileList object is specified, then it is copied into the curent CFileList. 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.
The following script lists files inside the folder specified by the string sFolder.
|
-- Create a new CFileList object |
|
-- step through the files |
|
-- list the next file name |
|
|
CFileList, delete, new_filelist, Next
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics,
Inc. All Rights Reserved.