Re: Ftp directory listing
090513 - extract the 1st 2 digits which is the year - 2009
and month / date you already have it...
Re: Ftp directory listing
Quote:
Originally Posted by
vcdebugger
090513 - extract the 1st 2 digits which is the year - 2009
and month / date you already have it...
No I don't. While the directory names appear to be related to a date, they aren't.
1 Attachment(s)
Re: Ftp directory listing
That depends on directory listing format provided by FTP server. For current century, it's not giving 2-extra digits.
See the attached file, which parses the directory listing from various format. You need to spend some time, to understand how it's working!
Find IsUNIXStyleListing in the file, and see comments above it.
Re: Ftp directory listing
Code:
09/07/2009 07:48AM Directory 090609
Code:
dr--rw---- 1 admin data 0 Sep 7 07:48 090609
Seems like you're missing the Year somehow all the other data is there.
But what i find interesting is this
Code:
01/01/1980 12:00AM Directory 930101
Code:
dr--rw---- 1 admin data 0 Jan 1 1980 930101
This one has a year but no time...
Re: Ftp directory listing
Thanks for looking into this, guys.
My original post didn't include enough of the directory sample.
The snippet below is what IE shows me when I navigate to the ftp folder.
Code:
09/21/2009 07:40AM Directory 090623
09/22/2009 07:44AM Directory 090624
09/23/2009 07:39AM Directory 090625
09/24/2009 07:37AM Directory 090626
09/25/2009 07:41AM Directory 090627
09/26/2008 07:58AM Directory 090628
09/27/2008 08:00AM Directory 090629
09/28/2008 07:40AM Directory 090630
09/29/2008 07:44AM Directory 090701
09/30/2008 07:40AM Directory 090702
10/01/2008 07:48AM Directory 090703
Notice the highlighted date in red and how how the date is from a year ago?
The whole reason for my code is that I'm trying to detect an older date than present.
I figured if I can read the directory listing like how Internet Explorer does, then I can parse the data and detect the older date.
As mentioned before, the problem is that when I progammatically read the data, it comes back without the complete date
Code:
dr--rw---- 1 admin data 0 Aug 14 07:47 090516
@Ajay. It is indeed Unix (TinyFtp), and thanks for your reply but the issue isn't parsing the data. The problem is that the data doesn't come back with what I need.
Is there another approach that I can take that will allow me to retrieve the data like I see in Internet Explorer?
Re: Ftp directory listing
ftp has two different types of directory listing commands, NLST and LIST. It could be that the api is using list and explorer is using nlst (which I think returns more info).
Re: Ftp directory listing
Thanks MadHatter. Here's what the Ftp commands are defined as:
Code:
publicconststring AppendFile = "APPE";
publicconststring DeleteFile = "DELE";
publicconststring DownloadFile = "RETR";
publicconststring GetDateTimestamp = "MDTM";
publicconststring GetFileSize = "SIZE";
publicconststring ListDirectory = "NLST";
publicconststring ListDirectoryDetails = "LIST";
publicconststring MakeDirectory = "MKD";
publicconststring PrintWorkingDirectory = "PWD";
publicconststring RemoveDirectory = "RMD";
publicconststring Rename = "RENAME";
publicconststring UploadFile = "STOR";
publicconststring UploadFileWithUniqueName = "STOU";
I've tried all the appropriate ones.
At any rate, I ended up solving the problem another way.
Thanks everyone.