Discuss (FTP), (FTP on .NET CF) and (FTPS, SFTP and SCP).
no avatar
User

apaulsavage

Posts

2

Joined

Tue Sep 02, 2014 8:24 pm

FTPClient.Exists always returns True

by apaulsavage » Wed Sep 03, 2014 2:25 am

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
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

Re: FTPClient.Exists always returns True

by support2 » Thu Sep 25, 2014 6:59 pm

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.

Who is online

Users browsing this forum: No registered users and 34 guests

Powered by phpBB ® | phpBB3 Style by KomiDesign
cron