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.