0

I have a windows service that connects to a FTP server and lists a directory with details. Based on the creation date of the files I am going to download them(I already have the code for the download). I have the function that returns a string[] in the following format:

09-30-14 01:52PM 9392 test.xlsx

From what I understood, they could be displayed in a different format like the one posted here: Parsing FtpWebRequest ListDirectoryDetails line which is something like that:

-rw-r--r-- 1 ftp ftp 659450 Jun 15 05:07 TEST.TXT

The first thing is, how do I deal with different formats?

And the second is, how can I select only files created after a specific time (for example after 09-30-14 01:50PM) ?

Community
  • 1
  • 1
Apostrofix
  • 2,140
  • 8
  • 44
  • 71
  • How many different formats do you expect? If it's just the two, I'd say write your own parser classes for them, which will solve both problems. – Ian Sep 30 '14 at 22:38
  • Yeah, that's the thing that I don't know what to expect. In my question I missed to say that it's actually a list of FTP servers that my service will connect to. And if we add a new FTP server that uses a different format.. However, I don't really see how this problem can be solved in the way that I am trying. – Apostrofix Oct 01 '14 at 06:18

1 Answers1

0

Not really an answer to the question, but at first I ended up with making a separate call to the FTP server to get the LastModified datetime of the file(not a good solution) and added them to a list of file names with creation dates. In the end it turned out that the creation date of the file is no longer important for the project, so I just used the standard FTP ListDirectory.

Apostrofix
  • 2,140
  • 8
  • 44
  • 71