how to find it is Folder or File in c# using FTP?

时间:2015-06-30 13:54:21

标签: c# ftp

When using the Method :

   ftpRequest.Method = WebRequestMethods.Ftp.ListDirectory;

I need to find out if the return from the method is either a folder or a file.

1 个答案:

答案 0 :(得分:0)

您可以致电WebRequestMethods.Ftp.ListDirectoryDetails并解析每一行。之后根据FTP服务器的类型,每行中的一些字符表示条目是文件还是文件夹(或第一个字符;它取决于FTP服务器;或者“日期”“指示符”等,您需要查找out表示它是文件或文件夹的char。)

如果我没记错的话,通常每行的第二个字符表示该条目是文件还是文件夹。

相关问题