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 theFindFirstFilemethod - File name and file size for the first matching file can be retrieved using
GetFindFileName()andGetFindFileSize()methods FindNextFilewill returnsFALSEin case no matching files were foundFindNextFilemust be called in-between a successful call toFindFirstFile()and a call toFindFileClose()- The method will return
FALSEif called outside this scope - When
FALSEis returned,FTPObject.LastErrorwill 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