Ciao. Non so se sia la soluzione ottimale ma io ho fatto una cosa simile in questo modo:
Private Function List(ByVal sCartella As String) As ListBox
Dim sr As IO.StreamReader
Dim lst As New ListBox
Dim ftpRequest As Net.FtpWebRequest
Dim ftpResponse As Net.FtpWebResponse
sr = Nothing
Try
ftpRequest = Net.FtpWebRequest.Create(sCartella)
ftpRequest.Credentials = New NetworkCredential(sUserFTP, sPasswordFTP)
ftpRequest.KeepAlive = False
ftpRequest.UseBinary = True
ftpRequest.Method = WebRequestMethods.Ftp.ListDirectory
ftpResponse = ftpRequest.GetResponse
sr = New IO.StreamReader(ftpResponse.GetResponseStream(), System.Text.Encoding.ASCII)
lst.Items.Clear()
While Not sr.EndOfStream
lst.Items.Add(sr.ReadLine)
End While
List = lst
Catch ex As Exception
List = Nothing
Finally
ftpRequest = Nothing
ftpResponse = Nothing
sr.Close()
End Try
End Function
Private Sub Main()
Dim lstFile As ListBox
lstFile = List(sPathSuperiore) //il path della cartella superiore a quella da creare
If lstFile.Items.IndexOf("nomecartella") <0 Then
//codice per creare la cartella
End If
End sub
Spero possa esserti d'aiuto. Ciao. Alessandra.