ftp <---> sd card

gapi

Active Member
Licensed User
Longtime User
Some examples of how to make a comparison between a folder on FTP and one in sd?
For upgrade same images in my app ... thanks ;)

p.s.
I already know a little library NET
 

kanaida

Active Member
Licensed User
Longtime User
Not sure if the ftp library lists folder contents with dates, but that would be the way to go. An asp.net http handler would work better though, as you can format it easily and have parameters. I'd pass it the last date+time of your images and get. Net to return you images modified > that date+ time as a string. Then parse the string in b4a with regex.Split and download those img urls.

Sent from my LG-MS840 using Tapatalk 2
 
Upvote 0

lagore

Active Member
Licensed User
Longtime User
The only problem with using the date/time option is if the ftp server is in a different time zone or set to UTC then if it is ahead of your location when you download the file its local created time will still be older then the server one.
 
Upvote 0

gapi

Active Member
Licensed User
Longtime User
what command for copy from FTP to SD ? I try with File.copy() but first parameter is a Dir ... not a FTP !

tnx
 
Upvote 0

lagore

Active Member
Licensed User
Longtime User
When you use ftp download
B4X:
MyFTP1.DownloadFile("Myserver",False,File.DirRootExternal,"MyNewSavedFile")
you can specify where to save the file, in the above example it is saved to the external sd card.
 
Upvote 0

gapi

Active Member
Licensed User
Longtime User
thanks lagore, but if I must execute two separate downloads .... it repeat "Download_Completed_Sub", there is a solution to differentiate the various download?

tnx
 
Upvote 0

lagore

Active Member
Licensed User
Longtime User
You have a couple of options depending on whether the download is coming from different servers or not. If the different downloads come from different servers then
B4X:
MyFTP1_DownloadCompleted (ServerPath As String, Success As Boolean)
the 'ServerPath' can be used to differentiate between the different servers in the download sub to perform different actions, if it is the same server but different files with different actions once downloaded then define more ftp objects.
B4X:
Dim MyFTP1 As FTP
 Dim MyFTP2 As FTP
when you initilise them they can have different Event names this will direct the downloadCompleted to the different subs. Clear as mud I hope?
 
Upvote 0
Top