bigMre bigMre - 1 month ago 7
Vb.net Question

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

Answer

Is this what you're after:

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

Dim newDirectory As String = directory.Substring(0, directory.LastIndexOf("\"))

Debug.Write(newDirectory)
Comments