I would like to download certain number of files from PC to a device using FTP. I cannot get the Sub ftp_ListCompleted involved in the code( Java compile error). I would like to cycle through the server folder and download only the given files I want. Here is the code:
Thank you very much
B4X:
Dim i , n As Short 'in global
Dim MyFile() As String 'in global
Dim DBfilePath as String ' in global: This is location on device
Dim MyInitials as String 'in global
Sub btnDownload_Click
MyInitials="XYZ"
FTP.List("Export") 'Export is the alias of the server folder containing the files
FTP_ListCompleted("Export", True, "", "") 'Here is the big problem
For i = 0 To n - 1 'n is the total number of files in folder
If MyFile(i).StartsWith("Base_") OR MyFile(i).StartsWith(MyInitials & "_") Then
FTP.DownloadFile("Export/" & MyFile(i) , False, DBFilePath, MyFile(i))
End If
Next
End Sub
'BELOW LIST COMPLETED
Sub FTP_ListCompleted (ServerPath As String, Success As Boolean, Folders() As FTPEntry, Files() As FTPEntry)
If Success = False Then
Log(LastException)
Else
For i = 0 To Files.Length - 1
MyFile(i)=Files(i).Name
n=n+1
Next
End If
End Sub