The server is Windows 2008R2. Changing the ConsiderDST flag in AddRawSettings() to 2 seems to have done the trick.
Will see if the timestamp changes once DST is over in November! :wink:
Actually setting PreserveTimestamp to false changes the date/time to that of the download, which I don't want. Is there a way in the code to set the same DST setting that is under Environment in the WinSCP GUI?
Thanks for getting back to me.
Our servers/workstations are in EST. The remote server is CMT (i.e. 1 hour behind EST). On our server the WinSCP GUI should the time of the file on the remote server to be one hour ahead. My workstation shows the correct time.
If I change the DST settings in Environment in the WinSCP GUI on our server, the time on the remote server displays correctly. But in the code, the file is always downloaded with the time being 1 hour ahead.
I have attached 2 screenshots. One from our server showing the WinSCP GUI and in the background the file downloaded from the code. And the second screenshot shows my workstation and WinSCP and the correct time.
Perhaps the solution is simply to set PreserveTimestamp withing TransferOptions to false. I'll try that.
Can you be more specific about what "timestamp of the files increases by +1 hour" means? What files? Local files after download compared against the remote files? Can you give a specific example? Like attaching a screenshot of both WinSCP file panels after the transfer in GUI and than the same after transfer using .NET assembly?
The problem I am encountering is that when downloading files from a remote server (this happens with different, independent SFTP sites) the timestamp of the files increases by +1 hour.
This issue only happens when running C# code on our servers using the WINSCP .NET library. Running in debug on local PCs work fine. Using the WINSCP GUI on the servers and on PCs the problem does not occur either.
The PCs are running Windows 7 and the server is Windows 2008R2. I am using version 5.1.5.
The code calls session.GetFiles(). If I explicitly create a TransferOptions object and set PreserveTimestamp = true the timestamp is still increased.
Our servers are based in New York - and I believe the servers we are connecting to are as well.
I have looked through related posts on the forums and elsewhere but could not find any fixes/suggestions. Any ideas at all?