bigMre
bigMre

Reputation: 29

Rename Folder with errors

Okay so i find another option, thats simpler. I want to rename the folder at Destination, but it dosnt work.

    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!")

Upvotes: 0

Views: 141

Answers (2)

Bugs
Bugs

Reputation: 4489

Is this what you're after:

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

Dim di As DirectoryInfo = Directory.GetParent(backupDirectory)

Debug.Write(di.FullName)

'Output:
'C:\Backup

Upvotes: 0

helrich
helrich

Reputation: 1310

Tricky one! Try this:

Destination = "C:\backup"

Upvotes: 1

Related Questions