c#判断ftp文件夹是否存在,不存在则创建文件夹


private void createdir()
        {
            string uri = "ftp://127.0.0.1/test/;

            if (!Directory.Exists(uri))
            {
                FtpWebRequest frequest = (FtpWebRequest)FtpWebRequest.Create(new Uri(uri));
                frequest.Credentials = new NetworkCredential(user, pwd);
                frequest.Method = WebRequestMethods.Ftp.MakeDirectory;
                try
                {
                    FtpWebResponse response = frequest.GetResponse() as FtpWebResponse;
                }
                catch { }
            }

        }




本文转自94cool博客园博客,原文链接:http://www.cnblogs.com/94cool/archive/2011/09/03/2164528.html,如需转载请自行联系原作者

上一篇:[二] JavaIO之File FileSystem WinNTFileSystem简介


下一篇:[一]JavaIO之FileDescriptor文件描述符