大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
例如,把文件"E:\新建文件夹\a.txt"复制到剪贴板
创新互联建站坚持“要么做到,要么别承诺”的工作理念,服务领域包括:成都网站建设、网站设计、企业官网、英文网站、手机端网站、网站推广等服务,满足客户于互联网时代的宕昌网站设计、移动媒体设计的需求,帮助企业找到有效的互联网解决方案。努力成为您成熟可靠的网络建设合作伙伴!
CreateObject("Shell.Application").NameSpace("E:\新建文件夹").ParseName("a.txt").InvokeVerb "复制(C)"
Option Explicit
Private Sub Command1_Click()
On Error GoTo RequestOut
Dim filename, putfile As String
With Inet1
.URL = "FTP地址"
.UserName = "用户名"
.Password = "密码"
.Execute , "CLOSE" '关闭连接。
End With
'以下是单文件上传
'(把D:\下的1.txt文件上传到XXXX的receive目录下)
Inet1.Execute , "send d:\1.txt /receive/1.txt" 'send 换为 put 一样,一个意思
Do While Inet1.StillExecuting
'
DoEvents
Loop
MsgBox "数据传输成功!"
Inet1.Execute , "QUIT" '关闭连接,退出FTP连接
Exit Sub
RequestOut:
MsgBox "没有可用的有效连接!Time Out!", vbInformation, "提示"
Inet1.Execute , "QUIT"
End Sub
Private Sub Inet1_StateChanged(ByVal State As Integer)
'状态提示
Dim temp As String
Select Case State
Case icNone
Case icResolvingHost
temp = "正在查找"
Case icHostResolved
temp = "已找到IP地址"
Case icConnecting
temp = "正在连接。。。。"
Case icConnected
temp = "连接成功"
Case icRequesting
temp = "正在发送请求。。。。"
Case icRequestSent
temp = "发送请求成功"
Case icReceivingResponse
temp = "正在接受 主机的响应"
Case icResponseReceived
temp = "已经接受主机的响应"
Case icDisconnecting
temp = "正在解除与主机的连接。。。"
Case icDisconnected
temp = "已解除与主机的连接。"
Case icError
temp = Inet1.ResponseCode Inet1.ResponseInfo
Case icResponseCompleted
temp = "数据传输完毕!"
End Select
Label1.Caption = temp
End Sub
用 io.Directory.Exists 判断文件夹是否存在。
再用 My.Computer.FileSystem.CopyDirectory() 复制。