c# 中ftp 编程中,判断ftp 服务器上某个目录是否存在的命令是什么?^_^ ,我忘记了,并且是否存在的返回值是多少了??

解决方案 »

  1.   

    rstatus[File-name]:若未指定文件名,则显示远程主机的状态,否则显示文件状态
      

  2.   

    private bool makeFileRequest(string fileName)
            {
                FtpWebRequest ftp = (FtpWebRequest)WebRequest.Create(fileName);
                ftp.Method = WebRequestMethods.Ftp.GetFileSize;
                try
                {
                    FtpWebResponse ftpresponse = (FtpWebResponse)ftp.GetResponse();
                    //return (int)ftpresponse.StatusCode;
                    return true;
                }
                catch (WebException ex)
                {
                    FtpWebResponse wr = (FtpWebResponse)ex.Response;
                    //return (int)wr.StatusCode;
                    return false;
                }
                catch
                {
                    return false;
                }
            }