I have if
condition issues when running the following code for an image file:
Dim mainFolder As String = "\\Users\No_Image_Available.png"
Dim saveDirectory As String = "\\IMAGE\"
Dim Filename As String = System.IO.Path.GetFileName(mainFolder)
Dim mainSavePath As String = System.IO.Path.Combine(saveDirectory, Filename)
If System.IO.File.Exists(mainSavePath) Then
'do nothing
Else
'file doesn't exist
My.Computer.FileSystem.CopyFile("\\Users\No_Image_Available.png", "\\IMAGES\No_Image_Available.png")
End If
If the file doesn't exist then it will accept the if statements by either IF Not exist
or IF exist
... however, if the file already exist it will take the copy argument whether it is in the right if condition or not.
Why is that? It is as if it still reads and accepts the first 'do nothing'
condition regardless.
FYI- the paths you see are fake