Imports System.Net.Mail
Imports System.Net
Imports System.IO
Public Function ListaFtp(ByVal Usuario As String, ByVal Senha As String) As ArrayList
Dim sArquivos As ArrayList = New ArrayList
Dim iContador As Integer
Dim fwr As FtpWebRequest = FtpWebRequest.Create("ftp://xxx.xxx.xxx.xxx/")
fwr.Credentials = New NetworkCredential(Usuario, Senha)
fwr.Method = WebRequestMethods.Ftp.ListDirectory
Dim sr As New StreamReader(fwr.GetResponse().GetResponseStream())
Dim str As String = sr.ReadLine()
iContador = 0
While Not str Is Nothing
sArquivos.Add(str)
str = sr.ReadLine()
End While
Return sArquivos
sr.Close()
sr = Nothing
fwr = Nothing
End Function
Nenhum comentário:
Postar um comentário