如何使用C#.Net使用ssh sftp客户端从sftp服务器只检索文本文件? [英] How to retrieve only text files from sftp sever using the ssh sftp client using C#.Net ?

查看:110
本文介绍了如何使用C#.Net使用ssh sftp客户端从sftp服务器只检索文本文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Readdir Command从服务器下载文件,它正在获取该工作目录中的所有文件,但我只需要下载文本文件。任何人都可以提前给我一个解决方案。

I have used Readdir Command for downloading files from the server , it is fetching all the files present in that Working directory , but i need only the text files to be downloaded.can any one give me a solution thanks in advance.

推荐答案

参考 - SFTP下载文件匹配模式 [ ^ ]。

Refer - SFTP Download Files Matching a Pattern[^].
Quote:

SFTP协议中没有任何内容可以让您请求目录列出仅匹配模式的文件。因此,不可能限制从服务器传输到客户端的目录列表的大小。要下载与模式匹配的文件,您将遍历目录中的文件,然后按名称下载每个文件,如下例所示:

There is nothing in the SFTP protocol that would allow you to request a directory listing for only files matching a pattern. Therefore, it is not possible to limit the size of the directory listing transferred from the server to the client. To download files matching a pattern, you would iterate over the files in the directory and then download each by name, as shown in this example:


这篇关于如何使用C#.Net使用ssh sftp客户端从sftp服务器只检索文本文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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