Why robocopy can't close when delete folder?

独自空忆成欢 提交于 2019-12-13 03:34:46

问题


I using robocopy to copy file from a Share folder "\\192.168.1.112\Share" to local folder "C:\test"

This is my code:

                Dim  strCMD="robocopy "\\192.168.1.112\Share" "C:\test" /MIR /NP /NDL /NFL /R:3 /W:1 /DCOPY:T"
                Dim oProcess As New Process()
                Dim oStartInfo As New ProcessStartInfo("cmd.exe", " /C" & strCMD)
                oStartInfo.UseShellExecute = False
                oStartInfo.RedirectStandardOutput = True
                oProcess.StartInfo = oStartInfo
                oProcess.Start()
                oProcess.WaitForExit()

                '++*************************************
            ' Get ouput infor
            '--*************************************
            Dim sOutput As String
            Using oStreamReader As System.IO.StreamReader = oProcess.StandardOutput
                sOutput = oStreamReader.ReadToEnd()
            End Using
            oProcess.Close() 

If folder "C:\test" is empty . it will working ok.

But if "C:\test" exist 1 original folder and 2 copy folder. cmd can't close.

Ex: Share folder:

\\192.168.1.112\Share\Translation

Local folder:

"C:\test\Translation"
"C:\test\Translation - Copy"
"C:\test\Translation - Copy (2)"

Why robocopy can't close cmd when delete folder?

来源:https://stackoverflow.com/questions/56055864/why-robocopy-cant-close-when-delete-folder

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!