FindNextFile
Searches for the next file matching the filemask specified by the FindFirstFile method.
Syntax
FindNextFile
Returns
- Boolean. If it returns
TRUE
, that means that more files were found which match the filemask specified by theFindFirstFile
method - File name and file size for the first matching file can be retrieved using
GetFindFileName()
andGetFindFileSize()
methods FindNextFile
will returnsFALSE
in case no matching files were foundFindNextFile
must be called in-between a successful call toFindFirstFile()
and a call toFindFileClose()
- The method will return
FALSE
if called outside this scope - When
FALSE
is returned,FTPObject.LastError
will return the WIN32 error code.
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
cr = Chr(13) + Chr(10)
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
echo "File: " + FTPobj.GetFindFileName + " size: " + CStr(FTPobj.GetFindFileSize) + " bytes type: " + FileType & cr
Found=FTPobj.FindNextFile
Wend
End Function