CFindFiles:GetTable CFindFiles:Open

CFindFiles:Next


The Next method returns the next file name inside the folder, matching the filename template.

Syntax

sFileName = CFindFiles:Next()

  • sFileName is the returned path string for the file. When done, nil is returned.

Remarks

This method iterates to the next file in the folder. If another file is found, the full path spec is returned. If no more files exist matching the template, nil is returned. The search must have been initialized using the new or Open method before calling Next. After Next returns, the file's path spec may be obtained from the return value or by calling the CFindFiles:GetPath method.

Example

The following script fragment 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

CFindFiles, Open