The \?\ prefix is automatically added by UiPath to support extended-length paths in Windows—this is normal and not the cause of the issue.
The “Access denied” error is typically due to permissions or the folder being in use. If you’re trying to delete something like C:\Users<user> , it may fail because:
The folder is currently in use (e.g., active user profile)
The robot is not running with sufficient privileges
Imports System.IO
Try
GC.Collect()
GC.WaitForPendingFinalizers()
'If folder exists, delete it forcefully
If Directory.Exists(folderPath) Then
Directory.Delete(folderPath, True)
End If
Catch ex As Exception
Throw New Exception("Failed to delete folder: " & ex.Message)
End Try