I am developing an application in vb.net that needs to use Robocopy to copy directories and all contents within the directories to a specified directory. Robocopy must be used because unlike drag and drop, it preserves the date modified and other properties of the files and folders it moves. I am using the following code to initiate this but I am getting an error
Win32 ExceptionUnhandled, Could not find the specified file.
I have done my research and this seems to be the most efficient way to call Robocopy... any help would be GREATLY appreciated.
Imports System
Imports System.IO
Imports System.Diagnostics
Imports System.Threading
Imports System.Windows.Forms
Public Class Form1
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
Dim srcFold As String = TextBox1.Text
Dim destFold As String = TextBox2.Text
'Dim oProcess As New ProcessStartInfo
'oProcess.FileName = "C:\windows\SysWow64\robocopy.exe"
'oProcess.Arguments = "C:\upsdnc\11111\" & "C:\ups\11111_dnc" & "/E /Z /dcopy:T /fft /R:10 /ETA /log:C:\copy.log /tee"
System.Diagnostics.Process.Start("C:\Windows\SysWow64\Robocopy.exe C:\upsdnc\11111 C:\ups\11111_dnc /E /Z /dcopy:T /fft /R:10 /ETA /log:C:\copy.log /tee")
End Sub
As you can see I also attempted using ProcessStartInfo but I am told Process.Start is much simpler.
Also, to use Robocopy, the format is "Source folder" "Destination Folder" followed by options as you can see in the above code