This method uses CDUP command for ".." pathnames. "." pathnames are ignored. For other pathnames, CWD command is used.
Both relative and absolute paths can be provided to the SetCurrentDirectory method to change the FTP server's current folder. However, some FTP servers might not support absolute paths, and different server types may have different ways of representing absolute paths. 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.
The current folder can be retrieved via the GetCurrentDirectory method.
Shows how to use SetCurrentDirectory method to change the current directory.
using System; using ComponentPro.Net; ... // Create a new class instance. Ftp client = new Ftp(); // Connect to the FTP server. client.Connect("myserver"); // Authenticate. client.Authenticate("userName", "password"); // ... // Change current directory to /myroot. client.SetCurrentDirectory("/myroot"); // ... // Disconnect. client.Disconnect();