C# Programming
05-12-2009, 11:32 AM
Hi guys
I have the code to get the directory list of the xml files in an folder but the problem is that i want to get the files in the creation date order. in other words each file has got an date it was created.
now i want to load all these xml files into an list array and in the creation date order.
is this possible? http://www.barakasoft.com/script/Forums/Images/smiley_confused.gif
my code sofar:
private String[] GetDirectory(String XmlFilePath)
{
List strList = new List();
FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(XmlFilePath);
request.Credentials = new NetworkCredential(Username, Password);
request.Method = WebRequestMethods.Ftp.ListDirectory;
StreamReader sr = new StreamReader(request.GetResponse().GetResponseStream());
while (!(sr.EndOfStream))
{
strList.Add(sr.ReadLine());
}
sr.Close();
sr = null;
return strList.ToArray();
}
I have the code to get the directory list of the xml files in an folder but the problem is that i want to get the files in the creation date order. in other words each file has got an date it was created.
now i want to load all these xml files into an list array and in the creation date order.
is this possible? http://www.barakasoft.com/script/Forums/Images/smiley_confused.gif
my code sofar:
private String[] GetDirectory(String XmlFilePath)
{
List strList = new List();
FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(XmlFilePath);
request.Credentials = new NetworkCredential(Username, Password);
request.Method = WebRequestMethods.Ftp.ListDirectory;
StreamReader sr = new StreamReader(request.GetResponse().GetResponseStream());
while (!(sr.EndOfStream))
{
strList.Add(sr.ReadLine());
}
sr.Close();
sr = null;
return strList.ToArray();
}