C# 如何使用C语言提取ftp服务器上存在的zip文件#

C# 如何使用C语言提取ftp服务器上存在的zip文件#,c#,ftpwebrequest,C#,Ftpwebrequest,我使用以下代码在ftp服务器上上传文件 FtpConnection ftp = new FtpConnection(serverip, ftpuser, ftppassword); ftp.Open(); ftp.Login(); ftp.SetCurrentDirectory("domain/wwwroot"); void CreateDirOnFtp(string sDir, FtpConnection ftp) { try

我使用以下代码在ftp服务器上上传文件

FtpConnection ftp = new FtpConnection(serverip, ftpuser, ftppassword);
ftp.Open();
ftp.Login();
ftp.SetCurrentDirectory("domain/wwwroot");

    void CreateDirOnFtp(string sDir, FtpConnection ftp)
            {
                try
                {
                    foreach (string f in Directory.GetFiles(sDir))
                    {
                        Uri uri = new Uri(f);
                        ftp.PutFile(f, System.IO.Path.GetFileName(uri.LocalPath));
                    }

                    foreach (string d in Directory.GetDirectories(sDir))
                    {
                        string dirname = new DirectoryInfo(d).Name;

                        if (!ftp.DirectoryExists(dirname))
                        {
                            ftp.CreateDirectory(dirname);
                        }

                        ftp.SetCurrentDirectory(dirname);
                        CreateDirOnFtp(d, ftp);
                    }
                }
                catch (System.Exception e)
                {
                }

            }
但这段代码并没有遍历所有目录,所以ftp服务器上缺少一些目录和文件

所以我决定在ftp上上传zip文件,并在ftp服务器上解压缩它,但是 我找不到任何方法来提取ftp服务器上存在的文件

我该怎么做?
或者在ftp服务器上上传多个目录和文件的任何其他更好的方法

您不能告诉服务器使用ftp协议提取文件。要做到这一点,您需要创建一些web服务,在上传后提取它,或者创建一些计划任务,提取它找到的所有拉链


如果你想创建一个web服务,那么FTP上传就可以完全放弃。服务方法可以接受压缩的内容并在服务器端将其解压缩。

尝试浏览您的目录并通过ftp上传。我认为这比在没有Web服务的服务器上解压缩文件要简单得多

我不想使用webservice?任何其他方式或第三方库?