How to get the last modified date of file from FTP?

TatyanaP

Member
Licensed User
Longtime User
Does this method File.LastModified (dirName, FileName) work with FTP folders?
When I download File from FTP to device date of last modified automatically changes.
 

TatyanaP

Member
Licensed User
Longtime User
B4X:
  FTP.Initialize("FTP", "1.1.1.1", 21, "FTPUser", "FTPPass")
  FTP.List("/Folder")
 
  FTP.PassiveMode = True
.
.
.

Sub FTP_ListCompleted (ServerPath As String, Success As Boolean, Folders() As FTPEntry, Files() As FTPEntry)
  If Success == False Then
      Log(LastException.Message)
  Else
      For i = 0 To Files.Length - 1
        Log(Files(i).Name)
      Next
      For i = 0 To Folders.Length - 1
        Log(Folders(i).Name)
      Next
  End If
End Sub

The result of code is a list of files:

file1.jpg
file2.db
. . .

But there is no last modified date ... Maybe I do something wrong?

In common I need to synchronize date (year) in device with server, cause there is no Internet connection.
Only this ftp is accessible.

If anybody knows some other ways to get date can help me?
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
You need to do something like:
B4X:
...
 
Log("File=" & Files(i).Name & "  Timestamp: " & Files(i).Timestamp)
 
...
 
Upvote 0

TatyanaP

Member
Licensed User
Longtime User
Have added this part of code and Timestamp shows wrong year that was set in device.
The day and month are correct.

Does anybody have ideas how to get correct Year else?
 
Upvote 0
Top