Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
1.3k views
in .NET FTP by (140 points)
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

1 Answer

0 votes
by (162k points)
We would need to see the log file to see what's happening. Exists is a fudge as there's no FTP command for it.

Categories

...