Click here to Skip to main content
15,897,315 members

Comments by Member 8652090 (Top 4 by date)

Member 8652090 16-Feb-12 16:18pm View    
Even more investigation reveals that my last statement wasn't accurate, as the most recent date that I could find for which the year was returned was 08/08/2011, while the oldest date for which the year was not returned was 09/23/2011. However, all dates include the year when viewing the directory in the browser. It seems that the year is included for all dates that are older than six months, but I have no idea why.
Member 8652090 16-Feb-12 15:58pm View    
Dave, further investigation seems to suggest that the year is not returned for files with a date that lies within the past 12 months, but is returned for all dates that are older than one year. Thus 12/02/2011 does not return the year, but 02/02/2011 does. I am very surprised by this, but I am at least happy that I seem to have found an explanation. Thanks for your help.
Member 8652090 16-Feb-12 14:43pm View    
The code was actually taken from this site, and was created by Howard Richards. The link to his code on this site is http://www.codeproject.com/Articles/11991/An-FTP-client-library-for-NET-2-0?msg=4159380#xx4159380xx.
However, code as simple as the following still has the same problem.
Dim ftp As FtpWebRequest = DirectCast(WebRequest.Create(Path), FtpWebRequest)
ftp.Method = WebRequestMethods.Ftp.ListDirectoryDetails
ftp.Credentials = New NetworkCredential(username, password)
ftp.Proxy = Nothing
ftp.KeepAlive = False
Dim fwResponse As FtpWebResponse = DirectCast(ftp.GetResponse(), FtpWebResponse)
Dim srResponse As New StreamReader(fwResponse.GetResponseStream)
Dim strResponse As String = srResponse.ReadToEnd
srResponse.Close()

I apologize if I have not submitted the code in the correct way. The strResponse returns the string with everything that you would expect, except for the year in each file's date.
Member 8652090 16-Feb-12 13:51pm View    
Unfortunately the same happens for dates from 2011. For example, the date that appears as 12/02/2011 08:25PM in the browser, appears as Dec 2 20:25 in the streamreader. I am confident that it is not the fault of the code, as the code has been posted on several sites regarding the use of FtpWebResponse and StreamReaders, and even if I make no changes to the code, the same problem arises. My only alternative at the moment is to use WebRequestMethods.Ftp.GetDateTimestamp for every file in the directory, but I certainly do not want to resort to doing that for a directory with numerous sub-directory levels.