+1 vote
by (150 points)
edited

I have connected to an FTP server and issued a FileExists command it is always returning true even for files that don't exist. I have tested it connecting to a different FTP server and it works fine. There must be some implementation problem.

Please can anyone help, it makes the FileExists command unusable if it's unreliable. The control seems great apart from this.

This is the code i have used

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Rebex.Net;

namespace TestFTP
{
   class Program
   {
    static void Main(string[] args)
    {
        using (Ftp client = new Ftp())
        {
            client.LogWriter = new Rebex.FileLogWriter(@"c:\rebexlog.txt", Rebex.LogLevel.Debug);

            client.Connect("testserver");
            client.Login("user", "password");

            if (client.FileExists("test.pdf"))
            {
                Console.WriteLine("Exists");
            }
            else
                Console.WriteLine("Not Exists");

            client.Disconnect();
        }
    }
}
}

This is the log file produced from REBEX. The file test.pdf does not exist on the server yet the FileExists command will return true and I will see Exists on the dos window.

2013-01-11 11:05:35.346 Opening log file.
2013-01-11 11:05:36.475 INFO Ftp(1)[9] Info: Connecting to testserver:21 using Ftp 4.0.4700.0 (trial version).
2013-01-11 11:05:36.475 INFO Ftp(1)[9] Info: Using proxy none.
2013-01-11 11:05:36.528 DEBUG Ftp(1)[9] Info: Connection succeeded.
2013-01-11 11:05:36.562 INFO Ftp(1)[9] Response: 220 FTP Service
2013-01-11 11:05:36.778 INFO Ftp(1)[9] Command: USER user
2013-01-11 11:05:36.815 INFO Ftp(1)[9] Response: 331 Password required for user (630812d0c5c7883c).
2013-01-11 11:05:36.816 INFO Ftp(1)[9] Command: PASS *********
2013-01-11 11:05:36.848 INFO Ftp(1)[9] Response: 230 User user logged in.
2013-01-11 11:05:36.849 INFO Ftp(1)[9] Command: FEAT
2013-01-11 11:05:36.881 INFO Ftp(1)[9] Response: 211-Extensions supported:
2013-01-11 11:05:36.882 INFO Ftp(1)[9] Response:  MDTM
2013-01-11 11:05:36.882 INFO Ftp(1)[9] Response:  SIZE
2013-01-11 11:05:36.882 INFO Ftp(1)[9] Response: 211 END
2013-01-11 11:05:37.167 INFO Ftp(1)[9] Command: TYPE I
2013-01-11 11:05:37.199 INFO Ftp(1)[9] Response: 200 Command okay.
2013-01-11 11:05:37.200 INFO Ftp(1)[9] Command: SIZE .
2013-01-11 11:05:37.230 INFO Ftp(1)[9] Response: 553 '/.': cannot read.
2013-01-11 11:05:37.230 INFO Ftp(1)[9] Command: SIZE test.pdf
2013-01-11 11:05:37.261 INFO Ftp(1)[9] Response: 553 '/test.pdf': cannot read.
2013-01-11 11:05:37.262 INFO Ftp(1)[9] Command: PWD
2013-01-11 11:05:37.293 INFO Ftp(1)[9] Response: 257 "/" is current directory.
2013-01-11 11:05:37.294 INFO Ftp(1)[9] Command: CWD test.pdf
2013-01-11 11:05:37.326 INFO Ftp(1)[9] Response: 550 'test.pdf': Not a directory or not accessible.
2013-01-11 11:05:39.405 INFO Ftp(1)[9] Command: QUIT
2013-01-11 11:05:39.437 INFO Ftp(1)[9] Response: 221 Service closing control connection.
Applies to: Rebex FTP/SSL

2 Answers

0 votes
by (144k points)
edited

Thanks for reporting this! It looks like FileExists should really return false in this case. We will check our code and most likely fix our implementation.

However, please be aware that FileExists method command can never be 100% reliable because many FTP servers don't even have such feature (it was not even a part of the original FTP protocol), which means we have to try a number of tricks to emulate it on some servers. This mostly works fine, but it's not perfect, particularly when using a not-so-common or outdated FTP server.

by (70.2k points)
edited

@zaceverett: I have sent you hotfix build to your email. Please let me know whether it solved your problem.

0 votes
by (70.2k points)
edited

UPDATE


There was another bugfix concerning the same issue in release 2015 R1 of Rebex FTP/SSL. See this forum post for more information.


This has been fixed in Rebex FTP/SSL 2013 R1.

...