Xceed .NET Libraries Documentation
DeleteFile Method


Xceed.Ftp Assembly > Xceed.Ftp Namespace > FtpClient Class : DeleteFile Method
The name of the file to delete. Some FTP servers may be case-sensitive!
Deletes a file from the FTP server.
Syntax
'Declaration
 
Public Sub DeleteFile( _

   ByVal file As String _

) 
'Usage
 
Dim instance As FtpClient

Dim file As String

 

instance.DeleteFile(file)
public void DeleteFile( 

   string file

)

Parameters

file
The name of the file to delete. Some FTP servers may be case-sensitive!
Exceptions
ExceptionDescription
Cannot perform the requested operation because the FTP client is in an invalid state.
An error reply was returned by the FTP server.
An I/O error has occurred.
A fatal FTP-specific error has occurred..
Remarks

By default, the file will be deleted from the current working folder. If you want to delete the file from another location, you could use the ChangeCurrentFolder and/or ChangeToParentFolder methods to change the current working folder. Absolute paths can also be provided, however some FTP servers might not support absolute paths and different server types may have different ways of representing absolute paths.

The current working folder can be retrieved via the GetCurrentFolder method.

The DeleteFile method will send the DELE command to the FTP server.

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

FtpClient Class
FtpClient Members