VS 2008 How to copying the file from one Directory to another directory by create the folder

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

How to copying the file from one Directory to another directory by create the folder

Hi,
I have some problem with copying the file from one Directory to another directory by create the folder if that folder is not exists in destination directory.
Example:
Source path: C:\temp\test\1.txt
destination path: C:\Data\
if C:\Data\ doesn't contains "temp" or "test" folder, it should create the folder before copy the 1.txt.

Copied to C:\Data\temp\test\1.txt

Below is my code. But it doesn't work..Please help

Code:

Private Sub btnBackup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBackup.Click
Dim sourcepath As String = "C:\temp\test\1.txt"
Dim DestPath As String = "C:\Data\"
CopyDirectory(sourcepath, DestPath)
End Sub
Private Shared Sub CopyDirectory(sourcePath As String, destPath As String)
If Not Directory.Exists(destPath) Then
Directory.CreateDirectory(destPath)
End If
For Each file__1 As String In Directory.GetFiles(sourcePath)
Dim dest As String = Path.Combine(destPath, Path.GetFileName(file__1))
File.Copy(file__1, dest)
Next
For Each folder As String In Directory.GetDirectories(sourcePath)
Dim dest As String = Path.Combine(destPath, Path.GetFileName(folder))
CopyDirectory(folder, dest)
Next
End Sub