If that's the case, then in this situation you'll have to resort to using
P/Invoke and the DeleteFile api. You can not delete a file with the .NET
functions that exceeds MAX_PATH - which is defined as 260 characters, even
though NTFS supports paths as long as 32k characters.
Here is the declare for the DeleteFile api:
Declare Auto Function DeleteFile Lib "kernel32" ( _
ByVal lpFilePath As String) As Boolean
Now, simply declaring and using this API won't work either - because the
file
api's also by default enforce the traditional MAX_PATH value. So, to
actually
get the function to delete a long path, you have to pre-append the value
"\\?\" to the path.
For example:
Dim p As String = "\\?\C:\Test\SomeFile.Txt"
If Not DeleteFile (p) Then
Throw New
System.ComponentModel.Win32Exception(Marshal.GetLastWin32Error())
End If
If you want a lot more information on this, just google MAX_PATH and .NET