SFTP DirectoryExists not working

0 votes
asked Nov 20, 2012 by Selventhran (250 points)
edited Dec 9, 2013

Hi, I have connected to one SFTP server using Rebex SFTP package and able to transfer the files into SFTP server. But DirectoryExists method is not working as expected, since it always returns as 'true' in both cases, whether the mentioned directory is present or not. I also found that ChangeDirectory method does not throw any error, if the mentioned directory is not present. Please find the sample code below

           ` Sftp server = new Sftp();
            server.Connect(strServerName);
            server.Login(strUserName, strPassword);
            Console.WriteLine(server.GetCurrentDirectory().ToString());
            bool bExists=server.DirectoryExists("Directory123");                 
            Console.WriteLine("The Directory (Directory123) Exists : " + bExists.ToString());
            bExists = server.FileExists("test.abc");
            Console.WriteLine("The File (test) Exists : " + bExists.ToString());`

FileExists is working as expected, where as DirectoryExists method is not.

Thanks

Applies to: Rebex SFTP
commented Nov 20, 2012 by Jan Sotola (16,920 points)
edited Nov 20, 2012

That is strange - both methods should work as you are expecting. We need to know your situation in more details.

Could you, please, create a comminication log as described on http://www.rebex.net/kb/logging/? Then you can either post the log here or send it us to support@rebex.net

1 Answer

0 votes
answered Nov 28, 2012 by Jan Sotola (16,920 points)
edited Dec 9, 2013
 
Best answer

The issue is most probably caused by a specific behavior of your SFTP server combinated with our workaround for AxwaySecureTransport SFTP server.

To disable this workaround, we've added a new setting to the Sftp.Settings property:

Sftp client = new Sftp();
client.Settings.DisableFxpStatWorkaround = true;
client.Connect(serverName);

This new setting will be available in the next release of Rebex components. If you are experiencing similar problem just now, please ask us for a hotfix on support@rebex.net.

commented Dec 9, 2013 by Jan Sotola (16,920 points)
edited Dec 9, 2013

The setting has been released in version 2013-R1.

...