how to copy folder along with content to another new folder??
hi all,i have a problem here,
i want to copy folder along with content to another new folder,
i use this code
Quote:
Dim source As String = ""
Dim destination As String = ""
source = "C:\Documents and Settings\user\Desktop\weapon"
destination = "C:\weapon\"
Try
If Not Directory.Exists(source) Then
MsgBox("file yg mo dipindahkan tidak ada")
Return
End If
If Directory.Exists(destination) Then
MsgBox("file destination sudah ada")
Return
End If
Dim a As DirectoryInfo = New DirectoryInfo(source)
a.MoveTo(destination)
Catch ex As Exception
MsgBox(ex.Message)
Return
End Try
this code make me copy source to destination but also delete source,:eek:
this code delete folder source and move to destination.:confused:
All i want is not delete folder source.:bigyello:
anyone can help me??;)
Re: how to copy folder along with content to another new folder??
My.Computer.FileSystem.CopyDirectory
Re: how to copy folder along with content to another new folder??
hi jmcilhinney
thx a lot,i have test using little size folder and it works well. :bigyello:
but with folder with contain 16.363 files and size 35,5 mb it take 1 minute.
it's ok,although it take a lot time.
thank you very much!
Re: how to copy folder along with content to another new folder??
Try copying that same folder in Windows Explorer. In theory it should take the exact same time as I believe they use the same functionality.
Re: how to copy folder along with content to another new folder??
If you want you can provide a progress UI using that functionality
Code:
My.Computer.FileSystem.CopyDirectory(sourceDirectoryName ,destinationDirectoryName ,showUI)