File.Exists return always true

+1 vote
asked Dec 16, 2014 by catan85 (130 points)
edited Feb 4, 2015

When I call File.Exists it always return true, even if the file doesn't exists. The version of Rebex ftp I've purchased is 4.0.5298.0; runtime version is v2.0.50727. Here is the code:

        Rebex.Net.Ftp f = new Rebex.Net.Ftp();
        f.LogWriter = new Rebex.FileLogWriter(@"log.txt", Rebex.LogLevel.Debug);
        f.Connect("192.168.138.154");
        f.Login("simotion", "simotion");

        if (f.FileExists("b:\\USER\\SIMOTION\\USER_DIR\\UPP\\UNITDS\\Var_Recipe\\ds000000.dat"))
        {
            Console.WriteLine("Exists");
        }
        else
            Console.WriteLine("Not Exists");

        f.Disconnect();

        Console.WriteLine("done");
        Console.ReadLine();

And here is the log:

2014-12-16 11:07:32.799 Opening log file.
2014-12-16 11:07:32.799 Using FileLogWriter version 2.0.5298.0.
2014-12-16 11:07:32.834 INFO Ftp(1)[9] Info: Connecting to 192.168.138.154:21 using Ftp 4.0.5298.0.
2014-12-16 11:07:32.834 INFO Ftp(1)[9] Info: Using proxy none.
2014-12-16 11:07:33.020 DEBUG Ftp(1)[9] Info: Connection succeeded.
2014-12-16 11:07:33.050 INFO Ftp(1)[9] Response: 220 Service ready
2014-12-16 11:07:33.070 INFO Ftp(1)[9] Command: USER simotion
2014-12-16 11:07:33.080 INFO Ftp(1)[9] Response: 331 User name ok, need password
2014-12-16 11:07:33.080 INFO Ftp(1)[9] Command: PASS ********
2014-12-16 11:07:33.090 INFO Ftp(1)[9] Response: 230 User logged in
2014-12-16 11:07:33.090 INFO Ftp(1)[9] Command: FEAT
2014-12-16 11:07:33.100 INFO Ftp(1)[9] Response: 500 Unknown cmd FEAT
2014-12-16 11:07:33.110 INFO Ftp(1)[9] Command: TYPE I
2014-12-16 11:07:33.120 INFO Ftp(1)[9] Response: 200 Command OK
2014-12-16 11:07:33.120 INFO Ftp(1)[9] Command: SIZE .
2014-12-16 11:07:33.130 INFO Ftp(1)[9] Response: 451 No such file or directory
2014-12-16 11:07:33.130 INFO Ftp(1)[9] Command: SIZE b:\USER\SIMOTION\USER_DIR\UPP\UNITDS\Var_Recipe\ds000000.dat
2014-12-16 11:07:33.140 INFO Ftp(1)[9] Response: 451 No such file or directory
2014-12-16 11:07:33.140 INFO Ftp(1)[9] Command: PWD
2014-12-16 11:07:33.150 INFO Ftp(1)[9] Response: 257 "/"
2014-12-16 11:07:33.150 INFO Ftp(1)[9] Command: CWD b:\USER\SIMOTION\USER_DIR\UPP\UNITDS\Var_Recipe\ds000000.dat
2014-12-16 11:07:33.160 INFO Ftp(1)[9] Response: 550 Unable to find B:\USER\SIMOTION\USER_DIR\UPP\UNITDS\Var_Recipe\ds000000.dat
2014-12-16 11:07:33.170 INFO Ftp(1)[9] Command: QUIT
2014-12-16 11:07:33.180 INFO Ftp(1)[9] Response: 221 Bye
Applies to: Rebex FTP/SSL

2 Answers

0 votes
answered Dec 29, 2014 by Lukas Pokorny (124,610 points)
edited Dec 29, 2014

Sorry for not replying earlier - we were having some issues with the forum (spambot overload) and missed your question. Next time, if we don't reply within a day or two, please let us know at support@rebex.net!

This said, it looks like you discovered a bug. The behavior you describe indeed occurs with FTP servers that behave like yours and it is obviously incorrect. We will fix it and provide a hotfix. Sorry for inconvenience!

0 votes
answered Jan 6, 2015 by Tomas Knopp (58,890 points)
edited Feb 4, 2015

UPDATE



The fix is now part of release 2015 R1 of Rebex FTP/SSL.




Once again, thank you for reporting this. It really was a bug in our Ftp.FileExists method. The promised hotfix is available to download (free trial).


For other customers experiencing the same issue - full hotfix version is available to registered customers with active support contract, just let us know you order ID/ registered email address to support@rebex.net and we'll send it to you. The fix will be part of version 2015R1.

...