FtpClient.Execute Method (String, Object[])

System.Net.FtpClient

Collapse image Expand Image Copy image CopyHover image
Executes a command

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

Syntax

C#
public FtpReply Execute(
	string command,
	params Object[] args
)
Visual Basic
Public Function Execute ( 
	command As String,
	ParamArray args As Object()
) As FtpReply
Visual C++
public:
virtual FtpReply Execute(
	String^ command, 
	... array<Object^>^ args
) sealed

Parameters

command
Type: System..::..String
The command to execute with optional format place holders
args
Type: array<System..::..Object>[]()[][]
Format parameters to the command

Return Value

Type: FtpReply
The servers reply to the command

Implements

IFtpClient..::..Execute(String, array<Object>[]()[][])

Examples

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

namespace Examples {
    static class ExecuteExample {
        public static void Execute() {
            using (FtpClient conn = new FtpClient()) {
                FtpReply reply;

                conn.Host = "localhost";
                conn.Credentials = new NetworkCredential("ftptest", "ftptest");

                if (!(reply = conn.Execute("SITE CHMOD 640 FOO.TXT")).Success) {
                    throw new FtpCommandException(reply);
                }
            }
        }
    }
}

See Also