new_findfiles


The new_findfiles function is a non-class version of the CFindFiles:new method which creates and returns a new CFindFiles object. The CFindFiles class iterates over files in a folder, fetching the names of files matching a template.

Syntax

F = new_findfiles()

bullet.gif    Creates a new object. You must call Open before file searching can be performed.

F = new_findfiles( sFolder )

bullet.gif    Opens file searching inside the named folder. The folder name is a complete path specification. Unless later changed by the Open method, the filename template is initialized to *.*.

F = new_findfiles( sFolder, sTemplate )

bullet.gif    Creates a new CFindFiles object for the specified folder using the specified file name template. The folder name is a complete path specification.

Remarks

Three overloads are provided for this method. If you use the default constructor with no arguments, then the Open method must be called to set the folder where searching is to be done. If the folder and optional template are specified in the constructor, then the Open method need not be called before calling Next.

Example

The following script lists files inside the folder specified by the string sFolder:

F = new_findfiles( sFolder )

-- Create a new CFindFiles object

while F:Next() do

-- Iterate to the next file

  Printf("%s\r\n", F:GetPath() )

-- list the current path name

end

 

F:Close()

-- finished with this object

Related Topics

CFindFiles, new, delete


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