VB.NET没有将文件夹复制到新目的地

时间:2016-11-04 07:48:22

标签: vb.net directory

所以我想在最后复制文件夹,但由于某种原因,它不会复制它。我没有收到错误消息,因此代码没有错误,只是不正确。

    Dim Log As String = System.IO.Path.Combine(DateTime.Now.ToString("yyyy_MM_dd_HHmmss"))
    Process.Start("CMD", "/c robocopy.exe " & Source & " " & Destination & " /log:C:\Backup\log_" & Log & ".txt ")



    Dim Copy2 As String = ("Backup_" & DateTime.Now.ToString("yyyy_MM_dd_HHmmss"))


    Dim Destination2 As String
    Destination2 = Destination
    Dim copy4 As String = Destination2.Substring(0, Destination2.LastIndexOf("\"))
    Dim Copy3 As String = System.IO.Path.Combine(copy4, Copy2)
    FileIO.FileSystem.CreateDirectory(Copy3)
    My.Computer.FileSystem.MoveDirectory(Destination, Copy3, True)
    MsgBox("Backup ist vollendet!")

1 个答案:

答案 0 :(得分:0)

您是否尝试结束进程,访问刚刚复制的数据? 试试:

  

process.kill