The RemoteFileInfo.LastWriteTime.Millisecond value is always 0.

Advertisement

kuzyaka
Joined:
Posts:
13

The RemoteFileInfo.LastWriteTime.Millisecond value is always 0.

After sending the file to the SSH server, the RemoteFileInfo.LastWriteTime.Millisecond value becomes 0.
Therefore, the date value of the local file is almost always greater than the date value of the remote file.
Dim fiLocalFile As New FileInfo("PathToLocalFile")
Dim rfiRemoteFile As RemoteFileInfo
rfiRemoteFile = sessionSSH.GetFileInfo("PathToRemoteFile")
 
fiLocalFile.LastWriteTime > rfiRemoteFile.LastWriteTime = True
Why the value of RemoteFileInfo.LastWriteTime.Millisecond is equal to 0?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: The RemoteFileInfo.LastWriteTime.Millisecond value is always 0.

Very few servers (if any at all) provide timestamps with milliseconds precision.

Reply with quote

kuzyaka
Joined:
Posts:
13

Re: The RemoteFileInfo.LastWriteTime.Millisecond value is always 0.

I thought so.
In my opinion, the simplest and most reliable solution would be to reset the milliseconds of the local file:
Dim fiLocalFile As New FileInfo("PathToLocalFile")
Dim rfiRemoteFile As RemoteFileInfo
rfiRemoteFile = sessionSSH.GetFileInfo("PathToRemoteFile")
 
fiLocalFile.LastWriteTime.AddMilliseconds(-fiLocalFile.LastWriteTime.Millisecond) = rfiRemoteFile.LastWriteTime = True

Reply with quote

Advertisement

You can post new topics in this forum