Home › Forums › .NET libraries › Xceed SFTP/FTP for .NET › File Existence
Can someone show me an example of how to check for a file’s existence on the server? I would like for the function to except the full filename.
Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Ray (had 621 views)
You can check ftp raw commands(CWD, LIST etc.) characteristics on the web.
As it shows, you can follow the steps blow.
1. Change the current directory until your target directory is current. -> FtpClient#ChangeCurrentFolder()
2. List up and enumerate the files of the current. -> FtpClient#GetFolderContents()
GetFolderContents can accept a file mask and returns a FtpItemInfoList collection.
the FtpItemInfoList collection contains FtpItemInfo items. So you can detect whether the target FtpItemInfo is in it.
Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Noriyuki (had 120 views)
Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Ray (had 736 views)