W
William LaMartin
The results I get below are as expected except for the Date/Time
information. This seems to be a bug in
System.Net.WebRequestMethods.Ftp.ListDirectoryDetails. It is not allowing
enough space for all the Date/Time information.
Does anyone have a solution for this other than getting the list by another
method?
For this code:
Dim fwr As System.Net.FtpWebRequest =
System.Net.FtpWebRequest.Create("ftp://" & Path)
fwr.Proxy = Nothing
fwr.Credentials = New
System.Net.NetworkCredential(Me.txtUsername.Text, Me.txtPassword.Text)
fwr.KeepAlive = False
fwr.Method =
System.Net.WebRequestMethods.Ftp.ListDirectoryDetails
Dim sr As New
System.IO.StreamReader(fwr.GetResponse().GetResponseStream())
Dim S As String = ""
S = sr.ReadToEnd
Clipboard.SetText(S)
Below is a sample of the returned text, which if displayed with a fixed
width font lines up perfectly. The problem, of course, is that some dates
have a time in place of a year
the line -rw-rw-rw- 1 user group 2591 Jul 10 2004
SendMail.aspx has a date but no time.
The line -rw-rw-rw- 1 user group 2519 Jan 13 00:57 Photos.aspx
had a date, the time but no year
drw-rw-rw- 1 user group 0 Feb 18 14:19 .
drw-rw-rw- 1 user group 0 Feb 18 14:19 ..
-rw-rw-rw- 1 user group 4445 Jun 21 2006 ACS.aspx
drw-rw-rw- 1 user group 0 Jan 3 21:47 ASP
-rw-rw-rw- 1 user group 2754 Jan 12 23:34 Default.aspx
drw-rw-rw- 1 user group 0 Apr 5 2006 Deployment
drw-rw-rw- 1 user group 0 Apr 5 2006 Gilbert
drw-rw-rw- 1 user group 0 Jan 1 18:41 Hurricanes
drw-rw-rw- 1 user group 0 Jan 1 19:21 LABW
-rw-rw-rw- 1 user group 1923 Dec 30 23:53 LocalSearch.aspx
-rw-rw-rw- 1 user group 457 Jan 1 14:29 OffSiteLinks.aspx
-rw-rw-rw- 1 user group 2519 Jan 13 00:57 Photos.aspx
-rw-rw-rw- 1 user group 49 Jun 20 2006 PrecompiledApp.config
-rw-rw-rw- 1 user group 95 Mar 9 2006 SendMail.asmx
-rw-rw-rw- 1 user group 2591 Jul 10 2004 SendMail.aspx
-rw-rw-rw- 1 user group 2911 Jul 15 2004 SendMail2.aspx
-rw-rw-rw- 1 user group 84 Mar 9 2006 SendMail20.asmx
-rw-rw-rw- 1 user group 3553 Dec 27 2004 SendTextMessage.aspx
information. This seems to be a bug in
System.Net.WebRequestMethods.Ftp.ListDirectoryDetails. It is not allowing
enough space for all the Date/Time information.
Does anyone have a solution for this other than getting the list by another
method?
For this code:
Dim fwr As System.Net.FtpWebRequest =
System.Net.FtpWebRequest.Create("ftp://" & Path)
fwr.Proxy = Nothing
fwr.Credentials = New
System.Net.NetworkCredential(Me.txtUsername.Text, Me.txtPassword.Text)
fwr.KeepAlive = False
fwr.Method =
System.Net.WebRequestMethods.Ftp.ListDirectoryDetails
Dim sr As New
System.IO.StreamReader(fwr.GetResponse().GetResponseStream())
Dim S As String = ""
S = sr.ReadToEnd
Clipboard.SetText(S)
Below is a sample of the returned text, which if displayed with a fixed
width font lines up perfectly. The problem, of course, is that some dates
have a time in place of a year
the line -rw-rw-rw- 1 user group 2591 Jul 10 2004
SendMail.aspx has a date but no time.
The line -rw-rw-rw- 1 user group 2519 Jan 13 00:57 Photos.aspx
had a date, the time but no year
drw-rw-rw- 1 user group 0 Feb 18 14:19 .
drw-rw-rw- 1 user group 0 Feb 18 14:19 ..
-rw-rw-rw- 1 user group 4445 Jun 21 2006 ACS.aspx
drw-rw-rw- 1 user group 0 Jan 3 21:47 ASP
-rw-rw-rw- 1 user group 2754 Jan 12 23:34 Default.aspx
drw-rw-rw- 1 user group 0 Apr 5 2006 Deployment
drw-rw-rw- 1 user group 0 Apr 5 2006 Gilbert
drw-rw-rw- 1 user group 0 Jan 1 18:41 Hurricanes
drw-rw-rw- 1 user group 0 Jan 1 19:21 LABW
-rw-rw-rw- 1 user group 1923 Dec 30 23:53 LocalSearch.aspx
-rw-rw-rw- 1 user group 457 Jan 1 14:29 OffSiteLinks.aspx
-rw-rw-rw- 1 user group 2519 Jan 13 00:57 Photos.aspx
-rw-rw-rw- 1 user group 49 Jun 20 2006 PrecompiledApp.config
-rw-rw-rw- 1 user group 95 Mar 9 2006 SendMail.asmx
-rw-rw-rw- 1 user group 2591 Jul 10 2004 SendMail.aspx
-rw-rw-rw- 1 user group 2911 Jul 15 2004 SendMail2.aspx
-rw-rw-rw- 1 user group 84 Mar 9 2006 SendMail20.asmx
-rw-rw-rw- 1 user group 3553 Dec 27 2004 SendTextMessage.aspx