Hi All
I am trying to download a load of files from an FTP server, I connect ok, and can read the folder names in the top level, but don't seem to be able to go down to get files at subdirectory levels, files(i) always comes back as Zero. I have tried changing paths, sending FTP commands but nothing works.
It always lists the files in the top level. Have attached Screenshot
Here is my code.... it is basically taken from the FTP example
I am trying to download a load of files from an FTP server, I connect ok, and can read the folder names in the top level, but don't seem to be able to go down to get files at subdirectory levels, files(i) always comes back as Zero. I have tried changing paths, sending FTP commands but nothing works.
It always lists the files in the top level. Have attached Screenshot
Here is my code.... it is basically taken from the FTP example
B4X:
'Non-UI application (console / server application)
#Region Project Attributes
#CommandLineArgs:
#MergeLibraries: True
#End Region
Sub Process_Globals
Dim ftp As FTP
End Sub
Sub AppStart (Args() As String)
ftp.Initialize("FTP","100.118.18.180","21","user","1234")
ftp.TimeoutMs=30000
ftp.PassiveMode=True
ftp.List("/SOLON7/MON/")
StartMessageLoop
End Sub
'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
Sub FTP_ListCompleted (ServerPath As String, Success As Boolean, Folders() As FTPEntry, Files() As FTPEntry)
Log(ServerPath)
If Success = False Then
Log(LastException)
Else
For i = 0 To Folders.Length - 1
Log(Folders(i).Name)
Next
For i = 0 To Files.Length - 1
Log(Files(i).Name & ", " & Files(i).Size & ", " & DateTime.Date(Files(i).Timestamp))
Next
End If
End Sub