FtpClient.CreateDirectory Method (String, Boolean)

System.Net.FtpClient

Collapse image Expand Image Copy image CopyHover image
Creates a directory on the server

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,
	bool force
)
Visual Basic
Public Sub CreateDirectory ( 
	path As String,
	force As Boolean
)
Visual C++
public:
virtual void CreateDirectory(
	String^ path, 
	bool force
) sealed

Parameters

path
Type: System..::..String
The full or relative path to the directory to create
force
Type: System..::..Boolean
Try to force all non-existant pieces of the path to be created

Implements

IFtpClient..::..CreateDirectory(String, Boolean)

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