C#FTP,如何检查路径是文件还是目录? [英] C# FTP, how to check if a Path is a File or a Directory?

查看:549
本文介绍了C#FTP,如何检查路径是文件还是目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



ftp // ip / directory / directory1,

我有一个包含一些FTP路径的数组,如下所示: ftp // ip / directory / directory2,

ftp // ip / directory / file.txt,

ftp // ip / directory / directory3, >
ftp // ip / directory / another_file.csv

如何查找路径是文件还是目录?



提前致谢

解决方案

使用LIST命令到RFC959,获取指定路径下项目的详细信息。以FileZilla Server为例,LIST命令将返回标准的LINUX权限格式,您可以在这里找到这里。第一个字母表示请求的路径是文件还是目录。另外一个用C#编写的简单库可以在这里找到

I have an array that contains some FTP pathes, like follows:

"ftp//ip/directory/directory1",
"ftp//ip/directory/directory2",
"ftp//ip/directory/file.txt",
"ftp//ip/directory/directory3",
"ftp//ip/directory/another_file.csv"

How can i find out if the path is a file or a directory?

Thanks in advance.

解决方案

Use the LIST command, which you can refer to RFC959, to get the details about items under the specified path. Take FileZilla Server for example, the LIST command will return standard LINUX permission format which you can find here. The first letter indicates if the requested path is file or directory. Also a simple library written in C# can be found here

这篇关于C#FTP,如何检查路径是文件还是目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆