Please Help! - Count Files On Ftp Server
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
7 posts
Page 1 of 1
Hi,
I'm looking for a way to count files on an ftp server cryer;
Please Help me cryer; cryer; cryer; cryer; cryer;
I'm looking for a way to count files on an ftp server cryer;
Please Help me cryer; cryer; cryer; cryer; cryer;
Hello MoDy Kareem,
Why do you have two threads about this?
Why do you have two threads about this?
Try:
Code: Select all
Dim req As FtpWebRequest = FtpWebRequest.Create("ftp://localhost/directory")
req.Credentials = New NetworkCredential("user", "password")
req.Method = WebRequestMethods.Ftp.ListDirectory
Dim resp As FtpWebResponse = req.GetResponse()
Dim sr As StreamReader = New StreamReader(resp.GetResponseStream())
Dim filelist As String = sr.ReadToEnd()
sr.Close()
resp.Close()
Dim filecount As Integer = 0
For i As Integer = 0 To filelist.Length - 1
If filelist(i) = vbLf Then filecount += 1
Next
MsgBox(filecount)
mandai wrote:Try:Thanks thats work cooll; cooll; cooll;Code: Select allDim req As FtpWebRequest = FtpWebRequest.Create("ftp://localhost/directory") req.Credentials = New NetworkCredential("user", "password") req.Method = WebRequestMethods.Ftp.ListDirectory Dim resp As FtpWebResponse = req.GetResponse() Dim sr As StreamReader = New StreamReader(resp.GetResponseStream()) Dim filelist As String = sr.ReadToEnd() sr.Close() resp.Close() Dim filecount As Integer = 0 For i As Integer = 0 To filelist.Length - 1 If filelist(i) = vbLf Then filecount += 1 Next MsgBox(filecount)
If you got what you wanted, then please lock the topic so this doesn't gets bumped whenever a member posts a post.
Usman55 wrote:If you got what you wanted, then please lock the topic so this doesn't gets bumped whenever a member posts a post.like yesterday , there was a post on a topic that wasn't used for like 10/11 months
7 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023