如果是用API
使用 FtpFindFirstFile,InternetFindNextFile(hFile, udtWFD)获取文件信息
Dim hFile As Long, udtWFD As WIN32_FIND_DATA
hFile = FtpFindFirstFile(server, adr, udtWFD, INTERNET_FLAG_RELOAD Or INTERNET_FLAG_NO_CACHE_WRITE, 0&)
你用什么连接服务器,我说一种用Inet控件的方法
加入Inet控件Name为ITC
Private Sub cmdSize_Click()
'If the itc is ready then get the size
If ITCReady(True) Then
RecievingSize = True
ITC.Execute , "SIZE " & Chr(34) & lstRemoteFile.Text & Chr(34)
Do Until ITCReady(False)
DoEvents: DoEvents: DoEvents: DoEvents
Loop
lblStatus = "Connected"
RecievingSize = False
End If
End Sub
Private Function ITCReady(ShowMessage As Boolean)
'Check the state of itc, if it is not executing return true
If ITC.StillExecuting Then
ITCReady = False
If ShowMessage Then
MsgBox "Please wait. FTP is still executing", vbInformation + vbOKOnly, "Busy"
End If
Else
ITCReady = True
End If
End Function