rardark
rardark

Reputation: 41

Can Delphi Indy Ftp idFTP.GET Preserve the File's Created and Modified Date?

I would like to ask if Delphi Indy ftp idFTP.GET can preserve the file's created and modified date? If not, how can I accomplish this?

Thanks!

Upvotes: 1

Views: 416

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 596216

TIdFTP.Get() creates a new local file, so the OS is going to assign the current date/time to that file by default. To assign the remote file's timestamp to the local file, you will have to retrieve the remote file's timestamp using either TIdFTP.FileDate(), TIdFTP.List(), or TIdFTP.ExtListDir(), and then apply the timestamp to the local file using platform-specific APIs, such as SetFileTime() on Windows, utimensat()/futimens() on Linux, etc.

Upvotes: 3

Related Questions