Android Question sync files from FTP

peacemaker

Expert
Licensed User
Longtime User
HI, All
Who works with FTP servers, please help.

If i need to sync files from FTP - i have to compare only file size or time.
File size is OK, but .... not "true way" :)

Time: FTPEntry object from NET lib has "Timestamp", downloaded file has File.LastModified time.

Is Timestamp the time of saving moment that FTP server provides ?
LastMobified - is it always the same - on FTP or after downloading the file ? Or also Android system updates it when file is saved into a folder ?

FTP servers has different time zones.... If i log these 2 Long digits - server's digit is always bigger than my local LastModified.
How to sync files, to download only new version (latest by time) of each file ?
 

peacemaker

Expert
Licensed User
Longtime User
Yes, thanks. But i cannot save it well :-(


B4X:
Sub Process_Globals
    PrevFiles() As FTPEntry
End Sub

Sub Save_FTPentries
Dim raf As RandomAccessFile
raf.Initialize(File.DirInternal, "ftp_entries.raf", False)
raf.WriteObject(PrevFiles, False, 0)
raf.Close
End Sub

Sub Restore_FTPentries
Dim raf As RandomAccessFile
raf.Initialize(File.DirInternal, "ftp_entries.raf", False)
Try
    PrevFiles = raf.ReadObject(0)    ' HERE is ALWAYS ARRAY with NULL items
Catch
    Log("Restore_FTPentries.error")
End Try
raf.Close
End Sub
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Erel, is it possible to update FTPEntry ? Make it with setter also, not only read-only.
If to update NET-lib, i guess, - it won't influence on projects, as always are read-only now
 
Upvote 0
Top