問題描述
使用 FtpWebRequest
列出目錄的內容;但是,它沒有顯示隱藏文件.
Using FtpWebRequest
to list the contents of a directory; however, it's not showing the hidden files.
如何讓它顯示隱藏文件?
How do I get it to show the hidden files?
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(ftp_root + path);
request.Method = WebRequestMethods.Ftp.ListDirectory;
FileZilla 正確列出了隱藏文件,因此我知道 FTP 服務器正在將這些數(shù)據(jù)返回給它.我只需要用 FtpWebRequest
復制它.或者為它使用不同的庫.
FileZilla lists the hidden files correctly so I know the FTP server is returning that data to it. I just need to replicate that with FtpWebRequest
. Or use a different library for it.
推薦答案
微軟提供的 FtpWebRequest
并不執(zhí)行列出 FTP、FTPS 或 SFTP 站點目錄所需的所有操作.
The FtpWebRequest
which is provided by Microsoft does not perform all the operations neccessary for listing FTP, FTPS or SFTP site's directories.
一個好的解決方案是使用一些其他的 dll,例如 WinScp、Ftp.dll,它們可以為您提供一些高效和額外的功能.
A good solution would be to use some other dll's like WinScp, Ftp.dll which can provide you with some efficient and extra functionalities.
這篇關于FtpWebRequest ListDirectory 不返回隱藏文件的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!