Reputation: 681
Sending the ListDirectory
to an FTP server but returns the first 2000 items from the FTP only. Adding SSL did not return more results.
Is there another library I should be using to get the full results?
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(OnValidateCertificate);
ServicePointManager.Expect100Continue = true;
FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://XXXX");
request.Method = WebRequestMethods.Ftp.ListDirectory;
request.Credentials = new NetworkCredential("User", "Password");
request.EnableSsl = true;
ServicePoint sp = request.ServicePoint;
Console.WriteLine("ServicePoint connections = {0}.", sp.ConnectionLimit);
sp.ConnectionLimit = 1;
using (var response = (FtpWebResponse)request.GetResponse())
{
using (var stream = response.GetResponseStream())
{
using (var reader = new StreamReader(stream, true))
{
string line = reader.ReadLine();
while (line != null)
{
ListFiles.Add(line);
line = reader.ReadLine();
}
}
}
}
Upvotes: 1
Views: 868
Reputation: 202272
This is hardly a client side problem. It's probably the FTP server that limits the listing.
Did you try with a standalone (GUI) client?
As you commented that you have SSH access to the server, try using SFTP protocol instead of FTP(S). Chances are the SFTP server won't have the limitation.
Upvotes: 0
Reputation: 12181
This is apparently a configuration issue on the server. See the following articles:
http://www.inmotionhosting.com/support/website/general-server-setup/incrrease-file-display-limit
Viewing more than 10,000 files on a FTP file server?
Basically, these articles recommend either changing the server configuration to allow you to view more files or sorting the files into more narrow directories so you can be more selective about which ones you want to view at any given time.
Upvotes: 0