FtpClient.CreateDirectory Method (String)

System.Net.FtpClient

Collapse image Expand Image Copy image CopyHover image
Creates a directory on the server. If the preceding directories do not exist they are created.

Namespace: System.Net.FtpClient
Assembly: System.Net.FtpClient (in System.Net.FtpClient.dll) Version: 1.0.5064.17461

Syntax

C#
public void CreateDirectory(
	string path
)
Visual Basic
Public Sub CreateDirectory ( 
	path As String
)
Visual C++
public:
virtual void CreateDirectory(
	String^ path
) sealed

Parameters

path
Type: System..::..String
The full or relative path to the new directory

Implements

IFtpClient..::..CreateDirectory(String)

Examples

C#  Copy imageCopy
using System;
using System.Net;
using System.Net.FtpClient;
using System.IO;

namespace Examples {
    public static class CreateDirectoryExample {
        public static void CreateDirectory() {
            using (FtpClient conn = new FtpClient()) {
                conn.Host = "localhost";
                conn.Credentials = new NetworkCredential("ftptest", "ftptest");
                conn.CreateDirectory("/test/path/that/should/be/created", true);
            }
        }
    }
}

See Also