GetFindFileName

GetFindFileName retrieves the filename of the currently matched file after a successful call to either FindFirstFile or FindNextFile methods.

When FindFileClose is called, GetFindFileName, GetFindFileSize and GetFindFileAttributes should not be used since this will make the Scripting engine fail.

Syntax

GetFindFileName

Returns

A String containing the file name.

Example

An example of RenameFile function in the FTPA protocol used to transfer files between network computers. Object. Renames all files found in the root of the FTP server:

Function Main

Dim FTPobj as Object

Const DIRECTORYMASK=&H10

ip = "127.0.0.1"

port = 21

Set FTPobj = FTP.Connect (ip,port,TRUE,"anonymous","lnss@gfi.com")

Found=FTPobj.FindFirstFile("*")

While Found

If (FTPobj.GetFindFileAttributes And DIRECTORYMASK) = DIRECTORYMASK Then

FileType="directory"

Else

FileType="file"

FileName = FTPobj.GetFindFileName

RenameFileName = "renamed_" + FTPobj.GetFindFileName

ret = FTPobj.RenameFile (FileName, RenameFileName)

End If

Wend

End Function