Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to create zip file on ftp server and download zip file from ftp in c#.

C#
public static void SaveFile(string[] MainDirs, string FileName, Uri FTPServer, string UserName, string Password)
       {
           try
           {
              ZipFile.CreateFromDirectory(FTPServer, FTPServer + FileName,CompressionLevel.Optimal, true);
}
Posted
Comments
ZurdoDev 7-Jan-15 8:11am    
Where are you stuck? This is not clear.

1 solution

What library are you using to create the .ZIP file??

Chances are really good that you cannot create the .ZIP on the FTP server. You have to create it locally and then upload the resulting .ZIP to the FTP server.
 
Share this answer
 
Comments
Rahulgupta.hanu 8-Jan-15 2:06am    
thank you for reply.
Srusti Thakkar 9-Feb-17 6:43am    
I am using DotNetZip library.
Dave Kreskowiak 9-Feb-17 7:54am    
What? Create the .ZIP file on the FTP server from files you upload to it? You can't. You're not going to get a process to run on the FTP server to create the .ZIP file.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900