pursuitofgold
New member
- Joined
- Jan 21, 2009
- Messages
- 1
- Programming Experience
- Beginner
Hey, I am having trouble listing all files in a directory with WebRequestMethods.Ftp.ListDirectory. Heres my code
Dim ftpWebReq As FtpWebRequest = FtpWebRequest.Create("ftp://website.com//log/")
ftpWebReq.Method = WebRequestMethods.Ftp.ListDirectory
ftpWebReq.Credentials = New NetworkCredential("user", "pass")
Dim ftpWebResp As FtpWebResponse = CType(ftpWebReq.GetResponse(), FtpWebResponse)
Dim streamer As Stream = ftpWebResp.GetResponseStream()
Dim reader As New StreamReader(streamer)
Dim sw As StreamWriter = New StreamWriter("c://test//test.txt")
sw.Write(reader.ReadToEnd)
streamer.Close()
sw.Close()
and theres two files in the directory, "boot.log" and "access_log_sep_08.log" but when I run this program only "boot.log" shows up. And when I try to directly Download these two files, I can download "boot.log" fine but get :
The remote server returned an error: (550) File unavailable (e.g., file not found, no access). when trying to download the other. I can view all of them fine in filezilla etc and permissions are all the same... Can someone help? thanks.
Dim ftpWebReq As FtpWebRequest = FtpWebRequest.Create("ftp://website.com//log/")
ftpWebReq.Method = WebRequestMethods.Ftp.ListDirectory
ftpWebReq.Credentials = New NetworkCredential("user", "pass")
Dim ftpWebResp As FtpWebResponse = CType(ftpWebReq.GetResponse(), FtpWebResponse)
Dim streamer As Stream = ftpWebResp.GetResponseStream()
Dim reader As New StreamReader(streamer)
Dim sw As StreamWriter = New StreamWriter("c://test//test.txt")
sw.Write(reader.ReadToEnd)
streamer.Close()
sw.Close()
and theres two files in the directory, "boot.log" and "access_log_sep_08.log" but when I run this program only "boot.log" shows up. And when I try to directly Download these two files, I can download "boot.log" fine but get :
The remote server returned an error: (550) File unavailable (e.g., file not found, no access). when trying to download the other. I can view all of them fine in filezilla etc and permissions are all the same... Can someone help? thanks.