FtpClient.DeleteFile Method

System.Net.FtpClient

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

Parameters

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

Implements

IFtpClient..::..DeleteFile(String)

Examples

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

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

See Also