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.

Syntax

sFileName = CFindFiles:GetPath()

bullet.gif    sFileName is the full path spec from the last call to Next.

Remarks

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.

Example

The following script 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 = new_findfiles()

-- 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, Next


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