FtpClient.SetWorkingDirectory Method

System.Net.FtpClient

Collapse image Expand Image Copy image CopyHover image
Sets the work 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 SetWorkingDirectory(
	string path
)
Visual Basic
Public Sub SetWorkingDirectory ( 
	path As String
)
Visual C++
public:
virtual void SetWorkingDirectory(
	String^ path
) sealed

Parameters

path
Type: System..::..String
The path of the directory to change to

Implements

IFtpClient..::..SetWorkingDirectory(String)

Examples

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

namespace Examples {
    public static class SetWorkingDirectoryExample {
        public static void SetWorkingDirectory() {
            using (FtpClient conn = new FtpClient()) {
                conn.Host = "localhost";
                conn.Credentials = new NetworkCredential("ftptest", "ftptest");
                conn.SetWorkingDirectory("/full/or/relative/path");
            }
        }
    }
}

See Also