Click here to Skip to main content
15,908,674 members
Please Sign up or sign in to vote.
1.20/5 (2 votes)
See more:
I want to Read Text files from FTP Server using with where condition. Where Created Date='12-03-2015'. Read the files which are created only on that Date.
Posted
Comments
Sinisa Hajnal 12-Mar-15 2:55am    
What have you tried?
Robymon 12-Mar-15 3:09am    
I did search in google, all saying to read all files from FTP Server. I don't want to read all files only files which are created only on particular date
Tomas Takac 12-Mar-15 3:33am    
I guess you need to list the files first, pick those whit fitting dates and download them one by one. Show your code, explain where are you stuck, then you have better chances to get the help you need.
Robymon 12-Mar-15 3:53am    
I tried with this code. This one got from google, but this code is not working

using (Ftp client = new Ftp())

{
client.Connect("ftp.example.org"); // or ConnectSSL for SSL
client.Login("user", "password");
List<ftpitem> items = client.GetList();
foreach (FtpItem item in items)
{
Console.WriteLine("Name: {0}", item.Name);
Console.WriteLine("Size: {0}", item.Size);
Console.WriteLine("Modify date: {0}", item.ModifyDate);
Console.WriteLine("Is folder: {0}", item.IsFolder);
Console.WriteLine("Is file: {0}", item.IsFile);
Console.WriteLine("Is symlink: {0}", item.IsSymlink);
Console.WriteLine();
}
client.Close();
}
Sergey Alexandrovich Kryukov 12-Mar-15 8:45am    
Perhaps you need to stop searching for code and start writing code.
—SA

1 solution

You can use the class System.Net.FtpWebRequest:
https://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest%28v=vs.110%29.aspx[^].

Look at the methods you can use with FTP: https://msdn.microsoft.com/en-us/library/system.net.webrequestmethods.ftp%28v=vs.110%29.aspx[^].

Perhaps you need to start with the method ListDirectoryDetails. Use it in first request, look at the HTTP response and see what files are in the list, parse it. And so on…

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900