|
-
Oct 28th, 2009, 10:23 PM
#1
Thread Starter
Lively Member
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
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,
this code delete folder source and move to destination.
All i want is not delete folder source.
anyone can help me??
-
Oct 28th, 2009, 10:29 PM
#2
Re: how to copy folder along with content to another new folder??
My.Computer.FileSystem.CopyDirectory
-
Oct 28th, 2009, 10:52 PM
#3
Thread Starter
Lively Member
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. 
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!
-
Oct 28th, 2009, 11:13 PM
#4
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.
-
Oct 29th, 2009, 12:49 AM
#5
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)
Please mark you thread resolved using the Thread Tools as shown
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|