Hi @OSVBNET ,
You can test if the path is writable by a function like the following.
Public Function IsDirectoryWritable(ByVal dirPath As String, Optional ByVal throwIfFails As Boolean = False) As Boolean
Try
Using fs As FileStream = File.Create(
Path.Combine(
dirPath,
Path.GetRandomFileName()
),
1,
FileOptions.DeleteOnClose)
End Using
Return True
Catch
If throwIfFails Then
Throw
Else
Return False
End If
End Try
End Function
Best Regards.
Jiachen Li
----------
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.