0 votes

Hi,

I use the FTP.ChangeFolder("some folder") Method to change to a subfolder of variable depth.
Now I want to return to the root folder without using ChangeFolderUp() several times. How is that possible?
ChangeFolder("/") or ChangeFolder("C:/") etc. did not work.

by
retagged by

1 Answer

0 votes

Use GetCurrentFolder method to get the root folder name as soon as you are logged in:

using(Ftp ftp = new Ftp())
{
   ftp.Connect("ftp.server.com");  // or ConnectSSL for SSL
   ftp.Login("user", "password");

   string root = ftp.GetCurrentFolder();

   ftp.ChangeFolder("subfolder");

   ftp.ChangeFolder(root);       

   ftp.Close();
}
by (300k points)
...