简体   繁体   English

使用C#从FTP写入和读取.txt文件

[英]Write And Read .txt files from FTP with C#

Is it possible to write a txt file on ftp (not upload a file to ftp!) Directly writing a txt file on ftp server) and read from a file on a ftp (not download a file from ftp!) Directly read from a txt file on ftp server? 是否可以在ftp上写入txt文件(不将文件上传到ftp!)直接在ftp服务器上写入txt文件)并从ftp上的文件读取(不从ftp下载文件!)直接从txt读取ftp服务器上的文件? I searched but ı found upload a file and donwload a file with FtpWebRequest class. 我进行了搜索,但我发现上传文件并使用FtpWebRequest类下载文件。 Note: FTP server uses credentials. 注意:FTP服务器使用凭据。

No, it is not possible. 不,不可能。

The FTP protocol described in RFC 959 doesn't have any means to achieve what you want. RFC 959中描述的FTP协议没有任何方法可以实现您想要的。

No, as far as I'm aware, your only option is to download or upload the file. 不,据我所知,您唯一的选择是下载或上传文件。 I guess you could short-circuit it a bit by only downloading the file until you got to the part you needed, then aborting. 我猜您可以通过仅下载文件直到找到所需的部分,然后中止操作来使其短路。 But the whole purpose of FTP is to upload/download FILES, not content. 但是FTP的全部目的是上传/下载文件,而不是内容。

It's possible with help of third-party virtual file system driver which should be installed in system. 可以通过应在系统中安装的第三方虚拟文件系统驱动程序来实现。 There exist third-party applications which let you see the remote FTP location as a virtual disk on your computer. 存在第三方应用程序,可让您将远程FTP位置视为计算机上的虚拟磁盘。 Once the remote FTP location is mounted this way you can use regular file I/O methods to read and write those files. 通过这种方式安装远程FTP位置后,您可以使用常规文件I / O方法读取和写入这些文件。 You can create such application as well (not a rocket science with right tools). 您也可以创建这样的应用程序(不是使用正确工具的火箭科学)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM