knutter539
asked on
Copying a Folder in vb.net to a specified place
i am using robocopy to copy directories from one mapped drive to another with...
Shell("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")
now i need to create variables to plug in based on a selected path in a dialog.
so for instance...
Source: J:\mill\33000s\33200s\3328 3
Destination: I:\ups\jobs\33000s\33200s\ 33283_Comp anyName\dn c
See, we have numerous job #s each which a corresponding folder on the other drive. i need to find a way for the destination path to be found based on the given source path. problem is the customer name throws a kink in things. the end of the source path (job#) will always match the job # on the destination path after the 5th "\" and up to the "_" so i suppose thats a start
Shell("C:\Windows\SysWow64
now i need to create variables to plug in based on a selected path in a dialog.
so for instance...
Source: J:\mill\33000s\33200s\3328
Destination: I:\ups\jobs\33000s\33200s\
See, we have numerous job #s each which a corresponding folder on the other drive. i need to find a way for the destination path to be found based on the given source path. problem is the customer name throws a kink in things. the end of the source path (job#) will always match the job # on the destination path after the 5th "\" and up to the "_" so i suppose thats a start
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
So i have 2 browse dialogs and the first is to point to src and second is pointing to where its going.
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
Shell("C:\Windows\SysWow64 \Robocopy. exe" & srcFold & destFold & "/E /Z /dcopy:T /fft /R:10 /ETA /log:C:\copy.log /tee")
says File Not Found though
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
Shell("C:\Windows\SysWow64
says File Not Found though
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
NOW im getting somewhere thank you! now it runs through but it only copies the files in mill to be inside of ups, it doesnt bring the folder itself inside of ups
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
MsgBox(srcFold)
Shell("C:\Windows\SysWow64 \Robocopy. exe" & " " & srcFold & " " & destFold & " " & "/E /Z /dcopy:T /fft /R:10 /ETA /log:C:\copy.log /tee")
^^^ Works for the files inside of the folder
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
MsgBox(srcFold)
Shell("C:\Windows\SysWow64
^^^ Works for the files inside of the folder
That's a robocopy issue then. I have not used it so don't know about different switches.
ASKER
Ok so i have it working now to where it copies everything over except the parent directory. im accepting a solution to my original question though as it has been answered (thank you).
All i need to figure out now is why when i select the "1111" entire job over to the archive drive, it doesnt take the parent folder.
So with 11111_dnc in the "ups" drive the top folder is "11111_customer" which is step 1 done. i copy it to archive and it moves everything but doesnt bring "11111_customer" folder with it. possibly a setting in robocopy to take parent folder?
All i need to figure out now is why when i select the "1111" entire job over to the archive drive, it doesnt take the parent folder.
So with 11111_dnc in the "ups" drive the top folder is "11111_customer" which is step 1 done. i copy it to archive and it moves everything but doesnt bring "11111_customer" folder with it. possibly a setting in robocopy to take parent folder?
ASKER
so inside of "11111" on ups needs to be the corresponding mill folder with a _dnc added
start: "J:\mill\11000s\11100s\111
move to: "I:\ups\jobs\11000s\11100s
the code i can't work through is how the program knows to pass all that company crap and know based on the job# where to stick the mill directory.
i apologize if this system is confusing as hell