B4J Question problem with FTP_List event

Blueforcer

Well-Known Member
Licensed User
Longtime User
Hello Friends,

when i call the myFTP.List function, the MyFTP_ListCompleted event will be called 42 times. (Log("Test")). But why? i need only one event to start the download from the listed files.

B4X:
myFTP.Initialize("MyFTP", IP , 21, "service", "xxxx")
myFTP.List("/FlashDisk")


B4X:
Sub MyFTP_ListCompleted (ServerPath As String, Success As Boolean, Folders() As FTPEntry, Files() As FTPEntry)
    If Success Then
   
        Dim i As Int
        Dim SubFolder As String
        SubFolder = ServerPath.Replace(DownloadFolderLocation.Replace(" ","_"), "") '

        For i = 0 To Folders.Length -1                                              
            If Folders(i).Name <> "." And Folders(i).Name <> ".." Then               
                myFTP.List(ServerPath & "/" & Folders(i).name)     
            End If
        Next

        If Files.Length >= 1 Then                                                   
            AddFileToDownloadList(ServerPath, File.DirApp &  "/" & currentIP & "/" & SubFolder, Files)    'add the files to the queue (list) to download
        End If
        btnDownload.Enabled = True
        pbProgress.Visible = False
  
    Else
         logWindow.text = "Online folder not found, check spelling..." & ServerPath
    End If

Log("Test")

End Sub
 
Top