日期:2009-07-21 浏览次数:20567 次
If Not Directory.Exists(strDirectoryDesPath) Then
Directory.CreateDirectory(strDirectoryDesPath)
End If
Dim f, fs() As FileInfo
fs = DirectorySrc.GetFiles()
For Each f In fs
File.Copy(f.FullName, strDirectoryDesPath & "\" & f.Name, True)
Next
Dim DirSrc, Dirs() As DirectoryInfo
Dirs = DirectorySrc.GetDirectories()
'递归调用自身
For Each DirSrc In Dirs
Dim DirDes As New DirectoryInfo(strDirectoryDesPath)
CopyDerictory(DirSrc, DirDes)
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
CopyDerictory(New DirectoryInfo("C:\Documents and Settings\username\Favorites"), New DirectoryInfo("g:\temp"))
End Sub