CFindFiles:GetPath
The GetPath method returns the filename obtained by the Next method. This method simply accesses the string saved by the last call to Next.
sFileName = CFindFiles:GetPath() sFileName is the full path spec from the last call to Next. |
This method simply accesses the static string where the file name was stored by the last call to Next. It is useful in iterating through a folder, as shown in the example below.
The following script fragment lists files inside the folder specified by the string sFolder and the filename template "h*.fts". Notice that F:Next() returns nil and terminates the loop before F:GetPath() is called after the last file has been processed.
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 |