在局域网中,如何将一台机器上一个目录中的内容copy到本地的一个目录中?

smartyyp 2003-04-04 02:37:00
在局域网中,如何将一台机器上一个目录中的内容copy到本地的一个目录中?
要求有代码,事例,绝对把分给达到点子上的人,绝不散分!
...全文
57 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
smartyyp 2003-04-08
  • 打赏
  • 举报
回复
thank
Montaque 2003-04-07
  • 打赏
  • 举报
回复
http://msdn.microsoft.com/library/en-us/dnvssamp/html/vbcs_CreateanExplorerStyleApplication.asp
Angelnet 2003-04-07
  • 打赏
  • 举报
回复
gz
smartyyp 2003-04-07
  • 打赏
  • 举报
回复
有详细的例子吗?
简单的方法我都知道,我要的是详细的解决方案!
吉安 2003-04-07
  • 打赏
  • 举报
回复
将C:\TEST目录下的文件拷贝到C:\DEST.
网络上只需要将C:\TEST定义为你的路径,比如:\\MACHINE1\SHAREFORLDER
Public Sub GetDir()

Dim sPath As String = "C:\Test\" '路径
Dim sName As String
Dim txtDestPath As String = "C:\Dest\"
txtDestPath = Microsoft.VisualBasic.Left(txtDestPath, Microsoft.VisualBasic.InStrRev(txtDestPath, "\"))
Try
sName = Dir(sPath, vbDirectory) ' Retrieve the first entry.
Catch ex As Exception
MsgBox("错误,你所指定的路径" & sPath & "可能不存在,请修改", MsgBoxStyle.Critical)
Exit Sub
End Try
Dim i As Long = 0
Do While sName <> "" ' Start the loop.
' Use bitwise comparison to make sure sName is a directory.
If (GetAttr(sPath & sName) And vbDirectory) <> FileAttribute.Directory Then
i = i + 1
End If
sName = Dir() ' Get next entry.
Loop
sName = Dir(sPath, vbDirectory) ' Retrieve the first entry.
Do While sName <> "" ' Start the loop.
' Use bitwise comparison to make sure sName is a directory.
If (GetAttr(sPath & sName) And vbDirectory) <> FileAttribute.Directory Then
Try
Dim xobj As New System.IO.FileInfo(sPath & sName)
Dim xobjLocal As New System.IO.FileInfo(txtDestPath & sName)
If xobj.LastWriteTime <> xobjLocal.LastWriteTime Then
System.IO.File.SetAttributes(txtDestPath & sName, IO.FileAttributes.Normal)
System.IO.File.Copy(sPath & sName, txtDestPath & sName)
End If
Catch ex As Exception
Try
System.IO.File.SetAttributes(txtDestPath & sName, IO.FileAttributes.Normal)

'Call Kill(txtDestPath & sName)
System.IO.File.Delete(txtDestPath & sName)
System.IO.File.Copy(sPath & sName, txtDestPath & sName)
Catch
End Try
End Try
End If
sName = Dir() ' Get next entry.
Loop
Exit Sub
End Sub
smartyyp 2003-04-07
  • 打赏
  • 举报
回复
up
dHMff 2003-04-04
  • 打赏
  • 举报
回复
穷举怎么举???不好意思,错了.
dHMff 2003-04-04
  • 打赏
  • 举报
回复
琼剧怎么举???
Montaque 2003-04-04
  • 打赏
  • 举报
回复
首先琼剧目录中的文件和目录,然后System.io.file.copy()

16,722

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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