如何取得ftp server上的文件的大小? (顶者有分)

klan 2003-07-02 06:06:13
如何取得ftp server上的文件的大小?
...全文
50 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
wouldfly 2003-07-04
  • 打赏
  • 举报
回复
Inet1.Execute , "SIZE " & """" & FileName & """"
FileSize = frmTmp.Inet1.GetChunk(1024)
klan 2003-07-03
  • 打赏
  • 举报
回复
我是用Inet控件的

我知道ftp上的文件名

现在要解决的问题是:如何让我知道这个文件的大小,并存储在变量中
道素 2003-07-03
  • 打赏
  • 举报
回复
如果是用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&)

文件的尺寸就是
Format((udtWFD.nFileSizeLow / 1024), "### ### ###.##")

==天下本无事,庸人自扰之==
得意淡然,失意泰然
-ch21st@hotmail.com
klan 2003-07-03
  • 打赏
  • 举报
回复
ITC.Execute , "SIZE " & Chr(34) & lstRemoteFile.Text & Chr(34)

这句是取得ftp上的文件的大小嘛?

我用了不可以的嘛(直接在ftp上用命令打进去的,不可以的)
道素 2003-07-03
  • 打赏
  • 举报
回复
你用什么连接服务器,我说一种用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


==天下本无事,庸人自扰之==
得意淡然,失意泰然
-ch21st@hotmail.com
klan 2003-07-03
  • 打赏
  • 举报
回复
???

谢了, 帮忙啊
klan 2003-07-03
  • 打赏
  • 举报
回复
郁闷,散分
New_bug 2003-07-03
  • 打赏
  • 举报
回复
帮你顶
klan 2003-07-03
  • 打赏
  • 举报
回复
怎么解决啊?

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧