CFindFiles:Open


The Open method specifies the folder name and the filename template for the CFindFiles object.

Syntax

CFindFiles:Open( sFolder )

CFindFiles:Open( sFolder, sTemplate="*.*" )

where

    sFolder is the name of the folder to be searched.

    sTemplate is a wildcard template for files to be found.

  

Call this method to setup the searching before beginning to iterate using Next. This method can be disregarded if the folder and template are specified in the new constructor. You can also specify different folders or templates using this method repeatedly for the same object, but be sure to call Close after finishing each search procedure, before calling the next Open.

Example

The following script lists files inside the folder specified by the string sFolder and the filename template "h*.fts"

F = CFindFiles:new()

-- Create a new CFindFiles object

F:Open( sFolder, "h*.fts" )

-- specify thefolder and template

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

Next

CFindFiles class