Checks if a file exsts on the server by taking a
file listing of the parent directory in the path
and comparing the results the path supplied.
Namespace: System.Net.FtpClient
Assembly: System.Net.FtpClient (in System.Net.FtpClient.dll) Version: 1.0.5064.17461
Syntax
C# |
---|
public bool FileExists(
string path,
FtpListOption options
) |
Visual Basic |
---|
Public Function FileExists (
path As String,
options As FtpListOption
) As Boolean |
Visual C++ |
---|
public:
virtual bool FileExists(
String^ path,
FtpListOption options
) sealed |
Return Value
Type:
BooleanTrue if the file exists
Implements
IFtpClient..::..FileExists(String, FtpListOption)
Examples
C# |
Copy
|
using System;
using System.Net;
using System.Net.FtpClient;
namespace Examples {
static class FileExistsExample {
public static void FileExists() {
using (FtpClient conn = new FtpClient()) {
conn.Host = "localhost";
conn.Credentials = new NetworkCredential("ftptest", "ftptest");
if (conn.FileExists("/full/or/relative/path",
FtpListOption.ForceList | FtpListOption.AllFiles)) {
}
}
}
}
}
|
See Also