Folder management using FTP (create, delete, rename)

Use CreateFolder, Rename and DeleteFolder methods for folder management on remote FTP server:

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
// C# version
 
using (Ftp client = new Ftp())
{
    client.Connect("ftp.example.org");
    client.Login("user", "password");
 
    client.CreateFolder("reports");
 
    client.Rename("reports", "reports 2010");
 
    client.DeleteFolder("reports 2010");
 
    client.Close();
}
01
02
03
04
05
06
07
08
09
10
11
12
13
14
' VB.NET version
 
Using client As New Ftp()
    client.Connect("ftp.example.org")
    client.Login("user", "password")
 
    client.CreateFolder("reports")
 
    client.Rename("reports", "reports 2010")
 
    client.DeleteFolder("reports 2010")
 
    client.Close()
End Using

You can download Ftp.dll FTP/FTPS component for .NET here.

Tags:    

Questions?

Consider using our Q&A forum for asking questions.