Page 1 of 1

SFTP preserve original file timestamps?

Posted: Wed 12 Oct 2011 19:28
by snorkel
Is it possible to have the SFTP client save the files with the original timestamp as was on the server?

Posted: Thu 13 Oct 2011 16:22
by Dimon
You can get the original timestamp of a server file using the TScSFTPClient.RetrieveAttributes method.
If you use the TScSFTPClient.DownloadFile method to download a file you should process the OnCreateLocalFile event handler, create a file, and set timestamp attributes for the locally created file, getting server values from the Attrs parameter (like AttrAttrs.CreateTime).
You can look at the example of processing the OnCreateLocalFile event in the SFTPClient demo.