public override string GetCurrentDirectory()
The FTP server's current folder is used by the FTP server as the base folder from which to perform file operations such as obtaining folder contents, receiving, sending and deleting files, changing the current folder, etc. It can be changed using the SetCurrentDirectory method. The GetCurrentDirectory method will send the PWD command to the FTP server.
Some servers (eg. TOPS-20) do not support this method.
Shows how to use GetCurrentDirectory method to get the current remote directory.
using System; using ComponentPro.Net; ... // Create a new class instance. Ftp client = new Ftp(); // Connect to the FTP server. client.Connect("localhost"); // Authenticate. client.Authenticate("test", "test"); // ... // Get the current directory. string absolutePath = client.GetCurrentDirectory(); Console.WriteLine("Current directory is '{0}'", absolutePath); // ... // Disconnect. client.Disconnect();