Hi again,
The following code snippet fails when the remote file does not exist.
Imports EnterpriseDT.Net.Ftp
RemoteFile(1) = "OUT_Joint.CSV"
' Step 2 transfer the files.
Dim FTPprocess As FTPClient = Nothing
FTPprocess = New FTPClient(Path)
FTPprocess.Login(user, password)
FTPprocess.ConnectMode = FTPConnectMode.PASV
FTPprocess.TransferType = FTPTransferType.BINARY
For ArrayCount = 1 To UBound(RemoteFile)
If Len(RemoteFile(ArrayCount)) > 0 Then
If FTPprocess.Exists(RemoteFile(ArrayCount)) = True Then
FTPprocess.Get(RemoteFile(ArrayCount), RemoteFile(ArrayCount))
End If
End If
Next
FTPprocess.Quit()
The command FTPprocess.Exists(RemoteFile(ArrayCount)) always returns True, even if the file does not exist.
I tried the following in the immediate window
? FTPprocess.Exists("gobbledegook.txt")
True
I thought to try and see if asking for a file that does indeed exist, to see if it returns False, but it too returned True. It appears that I have no checks to see if a file exists before 'Get' ting it. I then get an error on the Get command.
Am I doing something wrong here?
Cheers
Paul