Create folder on ftp

Posted by Afnan on Stack Overflow See other posts from Stack Overflow or by Afnan
Published on 2011-01-04T17:50:52Z Indexed on 2011/01/04 17:54 UTC
Read the original article Hit count: 229

Filed under:
|

I am using method to create folder on ftp i want get exception if folder already exsists how to make it over write the existing folder

using System; using System.Net;

class Test {
    static void Main()
    {
        WebRequest request = WebRequest.Create("ftp://host.com/directory");
        request.Method = WebRequestMethods.Ftp.MakeDirectory;
        request.Credentials = new NetworkCredential("user", "pass");
        using (var resp = (FtpWebResponse) request.GetResponse())
        {
            Console.WriteLine(resp.StatusCode);
        }
    } }

it is "remote server returned error (550) file not found"

© Stack Overflow or respective owner

Related posts about c#

Related posts about ftp