Hi
Does anyone know of a better quick way to
copy directories/files in VB.net than using
[code]
Computer.FileSystem.CopyFile
[/code]
The reason is because I’m developing a
system that copies files/directories from one or multiple location to one
location, to do this I use the below function
[code]
Public Sub copyDirectory(ByVal
strtoROOTlocation As String,
ByVal strrootfromName As
String, ByVal
root As DirectoryInfo, ByVal
intIndex As Integer,
ByVal video As Boolean)
Dim strfromDirectoryFullPath As
String = root.FullName
Dim strtoDrectoryName As
String
Dim blcopy As Boolean
If intIndex = 0 Then
strtoDrectoryName = ""
Else
strtoDrectoryName = "\" +
root.Name
End If
For Each fiifiles As FileInfo In
root.GetFiles
If blcopy Then
'This will stop Un needed files being copied
If Not
fiifiles.Extension = ".doc" And Not
fiifiles.Extension = ".fla" And Not
fiifiles.Extension = ".db" Then
My.Computer.FileSystem.CopyFile(strfromDirectoryFullPath
+ "\" + fiifiles.Name, strtoROOTlocation
+ "\" + strtoDrectoryName + "\" + fiifiles.Name, True)
'frmmain.build.BackgroundWorker1.ReportProgress("********"
+ fiifiles.Name, "full")
Else
End If
End If 'END IF (blcopy Second Level)
Next ' END Root Folder -
Content Loop
Else
End If 'END IF (NO video)
For Each driirectory As DirectoryInfo In
root.GetDirectories
copyDirectory(strtoROOTlocation + "\"
+ strtoDrectoryName, strtoROOTlocation + "\"
+ strtoDrectoryName, driirectory, intIndex + 1, video)
Next ' END Root Folder -
Content Loop
End Sub
[/code]
This seems fine until it starts copying large
files…
Does anyone know of a better way that I
could increase the speed of copying large files..
Thanks