Detects whether the specified file exists on the server. Not all FTP servers support this!

Namespace:  Rebex.Net
Assembly:  Rebex.Ftp (in Rebex.Ftp.dll)

Syntax

Visual Basic
Public Function FileExists ( _
	remotePath As String _
) As Boolean
C#
public bool FileExists(
	string remotePath
)

Parameters

remotePath
Type: System..::..String
The path of the remote file to check.

Return Value

True if the file exists, false otherwise.

Implements

IFtp..::..FileExists(String)

Remarks

The standard FTP protocol does not have a dedicated command that could be used to detect whether a file exists. There is the MLST command that is quite reliable, but not all server support it and we have to rely on SIZE or even PWD, CWD commands for these servers.

Version Information

.NET

Supported in: .NET 6.0, 5.0; .NET Framework 4.8, 4.7.x, 4.6.x, 4.5.x, 4.0, 3.5 SP1

.NET Standard 2.0

Supported in: .NET Core 3.1; .NET Core 2.1; Xamarin.Android 10.1 (or higher); Xamarin.iOS 13.10 (or higher)

See Also