重命名文件夹有错误

时间:2016-11-03 17:01:05

标签: vb.net variables edit

好的,所以我找到了另一种选择,那就更简单了。我想重命名目的地的文件夹,但它没有用。

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



    Dim Copy2 As String = ("Backup_" & DateTime.Now.ToString("yyyy_MM_dd_HHmmss"))
    My.Computer.FileSystem.RenameDirectory(Destination, Copy2)
    Process.Start(Copy2) 'öffnet explorer 
    MsgBox("Backup ist vollendet!")

2 个答案:

答案 0 :(得分:1)

整蛊一个!试试这个:

Destination = "C:\backup"

答案 1 :(得分:0)

这就是你所追求的:

Dim backupDirectory As String = "C:\Backup\Here"

Dim di As DirectoryInfo = Directory.GetParent(backupDirectory)

Debug.Write(di.FullName)

'Output:
'C:\Backup