Synchronization not preserving timestamp

Advertisement

baseliner
Guest

Synchronization not preserving timestamp

Hello - I'm trying to use the synchronize feature to synchronize two folders and noticed that the timestamp of the file on the target directory is set to the current timestamp instead of the timestamp on the source file.. so basically one ends up in an infinite loop since any time a synchronize is done, either the source or the target is always newer than the other. I have the Preserve Modification Time flag cheked and am using the "Both" directions transfer option. Is this a bug? Thanks.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
34,115
Location:
Prague, Czechia

Re: Synchronization not preserving timestamp

What version of WinSCP are you using? What protocol are you using?

Reply with quote

Guest

Re: Synchronization not preserving timestamp

martin wrote:

What version of WinSCP are you using? What protocol are you using?
Hi,
I'm not the original poster, but have the exact same problem.
I'm using command-line batch mode, protocol is FTP, version of WinSCP is 4.16
using the following: "synchronize remote localdir ftpdir -delete -mirror" the files on the FTP server always get a new time stamp.
Additionally, all files are uploaded to the FTP server, although identical. Even if this was because of the time stamp, it is newer on the FTP!
regards

Reply with quote

rmfii
Guest

"Preserve Timestamp" doesn't work on Windows FTP

We have encountered the same problem with v4.1.6. Even w/ "Preserve Timestamp" checked, the transferred file is given a Create Date = when the file is first starting to be written, and Modify Date = when the file is done writing.

Maybe related: the "Synchronize Timestamps" option on the Synchronize menu is disabled. (And given all the out-of-synch timestamps we have now, we could really use that feature!)

I humbly submit a big plug to get this fixed! Thank you.

Reply with quote

Advertisement

-vh-
Guest

Winscp (MDTM vs MFTM .....)

Just for info
At this moment we are facing problem with Winscp (versions: 382,406,419,423)facing the WS_FTP-SSH2 using SFTP protocol.

Version 3.8.2 - no any possible way to avoid error message after issuing MDTM command

Version 4.0.6 / 4.1.9.
- only those options does not cause the "error message" :
The server does not support the operation.
Error code: 8
Error message from server: SSHServerAPI.SFTP.fxp_attrs
Request code: 9
Winscp:options
preserve timestamp OFF
ignore permission errors OFF
set permission OFF

Version 4.2.3beta
- so far very same as for 4.0.6./4.1.9., so I am not sure if i missed some option in this new version or not.

I am gathering information from the server side, to get some relevant info about MFTM/MDTM options/restrictions set on server side. Coz I am little bit confused(see below part) by all those RFC specification and implementation by correspond developers of their pieces (winscp,filezilla,ws_ftp.....etc)

Anyway, is it possible to make MDTM/MFTM situation once for all clear?
Do we (winscp) following the RFC specification for FTP/SFTP protocol at matter MDTM/MFTM or not?
Will be there any option like "legacy mod" (when facing the old server using MDTM in old fashion way?).

Or maybe it will be great to have those options (preserve timestamp;ignore permission errors;set permission) optionable per session.

Regards
-vh-

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
34,115
Location:
Prague, Czechia

Re: Winscp (MDTM vs MFTM .....)

-vh- wrote:

Anyway, is it possible to make MDTM/MFTM situation once for all clear?
Do we (winscp) following the RFC specification for FTP/SFTP protocol at matter MDTM/MFTM or not?
Will be there any option like "legacy mod" (when facing the old server using MDTM in old fashion way?).
MDTM/MFTM commands are for FTP protocol. So it is unrelated to the SFTP. So actually I'm not sure what you are after. If you server does not support setting permissions/timestamp, what can WinSCP do?

Or maybe it will be great to have those options (preserve timestamp;ignore permission errors;set permission) optionable per session.
It can be configured per host using transfer settings presets.

Reply with quote

Guest

Re: Winscp (MDTM vs MFTM .....)

martin wrote:


MDTM/MFTM commands are for FTP protocol. So it is unrelated to the SFTP. So actually I'm not sure what you are after. If you server does not support setting permissions/timestamp, what can WinSCP do?

Actually, what I need is to know that MDTM command is used in proper way by WinSCP when the files are uploaded. I mean that the MDTM is not used to "change" but only to "retrieve" datetimestamp. For me, SFTP is just FTP covered in SSH tunnel so the commands are pretty same.

martin wrote:


-vh- wrote:

Or maybe it will be great to have those options (preserve timestamp;ignore permission errors;set permission) optionable per session.
It can be configured per host using transfer settings presets.

Thanks for pointing me to that option. This will help me. :) I was not just happy to set it globally and TBO i missed this option. So far I used winscp with default setup. :D

cheers
-vh-

Reply with quote

-vh-
Guest

Re: Winscp (MDTM vs MFTM .....)

-vh- wrote:


Actually, what I need is to know that MDTM command is used in proper way by WinSCP when the files are uploaded. I mean that the MDTM is not used to "change" but only to "retrieve" datetimestamp. For me, SFTP is just FTP covered in SSH tunnel so the commands are pretty same.
Seems i have to RTFM, especially >> https://winscp.net/eng/docs/protocols
Anyway i just want to not to recieve any pop-ups with such error:
Error code: 8
Error message from server: SSHServerAPI.SFTP.fxp_attrs
Request code: 9

.... and actually I am looking to get some background information, about "what is the standard" if i have to make some changes in setup on client side rather than on server side. Due the SFTP procotl is still in "Draft4" is it not so clear for me. Some other clients/servers are facing very similar issues. At this moment i have option for my client (thanks to "transfer presets") and also prove that "ipswitch's WS_FTP" has option to "check/uncheck" "preserve time on upload".

cheers
-vh-
PS: thanks for your time and for WinSCP :)

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
34,115
Location:
Prague, Czechia

Re: Winscp (MDTM vs MFTM .....)

-vh- wrote:

.... and actually I am looking to get some background information, about "what is the standard" if i have to make some changes in setup on client side rather than on server side. Due the SFTP procotl is still in "Draft4" is it not so clear for me. Some other clients/servers are facing very similar issues. At this moment i have option for my client (thanks to "transfer presets") and also prove that "ipswitch's WS_FTP" has option to "check/uncheck" "preserve time on upload".
Sorry, I do not know how to help you. Obviously your server does not implement part of the SFTP functionality. You can avoid WinSCP using that functionality by option you already know. What more do you want?

Reply with quote

Guest

Re: Winscp (MDTM vs MFTM .....)

martin wrote:

Sorry, I do not know how to help you. Obviously your server does not implement part of the SFTP functionality. You can avoid WinSCP using that functionality by option you already know. What more do you want?

That's fine. I already know how to handle such event/error/pop-up at this moment. Also I am trying to force admin of that particular SFTP site to take look at it from server side. Seems that the problem is more related to their setup.

Cheers
-vh-

Reply with quote

rlaw
Guest

Re: Synchronization not preserving timestamp

martin wrote:

This issue has been added to tracker.

This tracker shows that Bug#293 has been fixed as of version 4.2, but I am using version 4.27 and still having timestamp problems. (The copied files have the current timestamp rather than the original timestamp of the source.)

I am running in batch mode, FTP protocol, WinSCP 4.27(build 758). Is there a special option I'm supposed to use for this? (I tried using -preservetime even though that is not actually an option for "synchronize" mode. Doesn't do anything, as expected)

Thanks for the help,
rlaw

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
34,115
Location:
Prague, Czechia

Re: Synchronization not preserving timestamp

rlaw wrote:

This tracker shows that Bug#293 has been fixed as of version 4.2, but I am using version 4.27 and still having timestamp problems. (The copied files have the current timestamp rather than the original timestamp of the source.)
Your server may not support the commands needed.

Please post a full log file showing the problem.

To generate log file, enable logging, log in to your server and do the operation and only the operation that causes the error. For posting extensive logs you may use pastebin or similar application. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you may email it to me. You will find my address (if you log in) in my forum profile. Please include link back to this topic in your email. Also note in this topic that you have emailed the log.

Reply with quote

Advertisement

TC
Guest

I also saw a strange behavior with the time stamp during synchronize in the command line and also with the gui...!

First a small explanation..., we use WinSCP with the protocol SFTP with some users to have access to some shares. Everybody of this group has full access rights to this share and can update files there..!
If I update files to that share everything is okay when I have updated also the files before (no problem with the time stamp!).
But if somebody else copy files to that share and I will update with my account afterwards the time stamp is changing to the time when this action is done!
So it seems that WinSCP has a problem with this time stamp if more than one user is handling files...?!
We have chosen the option "Preserve timestamp" in the frontend and we (I and my colleagues) are using the version 4.2.7!

Any opinion..., is it a bug?!

Additionally I have a questions...!

Are there some further time stamp options available for "synchronize" in the command line as they are available for "get" (e.g. -preservetime)?

But I don't guess that it's only a problem of the command line, because I saw this issue also in the front end.

Thanks in advance for your answers and your help...!

Regards
TC

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
34,115
Location:
Prague, Czechia

TC wrote:

If I update files to that share everything is okay when I have updated also the files before (no problem with the time stamp!).
Please post a full log file showing the problem.

To generate log file, enable logging, log in to your server and do the operation and only the operation that causes the error. For posting extensive logs you may use pastebin or similar application. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you may email it to me. You will find my address (if you log in) in my forum profile. Please include link back to this topic in your email. Also note in this topic that you have emailed the log.

Reply with quote

TC
Guest

Hello!

As requested I've sent you an email with the required log file and additionally with some screen shots...!

Thanks in advance for your support!

Regards
TC

Reply with quote

alpineman
Joined:
Posts:
1
Location:
Tirol/Austria

preserving of timestamps works if the server supports it

Maybe I am telling now something everybody knows, but maybe some helps the following information.
Feature request: it would be very nice if I could switch between using MFMT and MDTM to set timestamps because there are ftp-server like the default from IIS 7.5 which supports only MDTM to set timestamps.

I have winscp 5.1.4 portable and preserving of timestamps via FTP (i am talking only about ftp here) works if THE SERVER SUPPORTS the feature MFMT.
To check if the server supports one of the two Commands you have to enter the Command FEAT. Some Server say "Operation not permitted" some tell you a list with "advanced commands".

Thanks to the developer in investigating ressources in winscp!
Anil (from Austria)

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
34,115
Location:
Prague, Czechia

Re: preserving of timestamps works if the server supports it

alpineman wrote:

Feature request: it would be very nice if I could switch between using MFMT and MDTM to set timestamps because there are ftp-server like the default from IIS 7.5 which supports only MDTM to set timestamps.
MDTM reads, not sets, remote file timestamp.
https://tools.ietf.org/html/rfc3659#section-3

There are indeed FTP clients and servers that implement also setting timestamp using MDTM, but that's non-standard behaviour from times, when there was no support for setting timestamps using FTP.

But that's over 10 years ago (first MFMT draft is from 2002). So I do not see much sense implementing some non-standard functionality to support ancient servers. I'm sorry.

Reply with quote

tester.it
Joined:
Posts:
6
Location:
Italy

FTP sync and timestamp

Hello,

i'm trying to sync/mirror a ftp folder tree to a local folder with the following configuration:

SW VERSION: WinSCP 5.17.7 Build 106.40.
PROTOCOL: FTP
METHOD: Powershell Script
SOURCE: Windows 2000 Professional, Ftp Server (IIS), UTC+1 timezone, DST.
DESTINATION: Windows Server 2012R2, Folder, UTC+1 timezone, DST.

but having timestamp problems on destination files.
readed faqs and tried several combination also with GUI but without success.

In attachment the job log, here powershell script used:

# Load WinSCP .NET assembly
 
$WinSCPfolderRoot="C:\Program Files (x86)\WinSCP\"
Add-Type -Path (Join-Path $WinSCPfolderRoot "WinSCPnet.dll")
 
# Setup session options
$sessionOptions = New-Object WinSCP.SessionOptions
$sessionOptions.Protocol = [WinSCP.Protocol]::ftp
$sessionOptions.HostName = "dad"
$sessionOptions.UserName = "ftpuser_1"
$sessionOptions.Password = "Password1"
 
$session = New-Object WinSCP.Session
 
# Log
$session.SessionLogPath = "C:\MYPATH\MYFOLDER\backup.log"
 
# Connect
$session.Open($sessionOptions)
 
# Synchronize Files
$session.[WinSCP.TransferResumeSupportState]::On
 
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.ResumeSupport.State = [WinSCP.TransferResumeSupportState]::On
    
$synchronizationResult = 
$session.SynchronizeDirectories([WinSCP.SynchronizationMode]::Local,"C:\MYPATH\MYFOLDER\DATAFOLDERLOCAL", "/datafolderftp/", $True, $True, [WinSCP.SynchronizationCriteria]::Either, $transferOptions)
 
$synchronizationResult.Check()
 
# Disconnect, clean up
$session.Dispose()

thanks.
  • backuplog.log (16.88 KB, Private file)
Description: job log

Reply with quote

martin
Site Admin
martin avatar

Re: FTP sync and timestamp

tester.it wrote:

but having timestamp problems on destination files.
Sorry, that's too vague. What problems?

Reply with quote

Advertisement

martin
Site Admin
martin avatar

Re: FTP sync and timestamp

OK, but the log files does not show how's that related to WinSCP.
Why should the timestaps match? Were they uploaded by WinSCP? Then we need log file that show the upload and consequent listing of the remote folder.

Reply with quote

tester.it
Joined:
Posts:
6
Location:
Italy

Re: FTP sync and timestamp

no upload, the need is only to download (mirror) an ftp to a local ntfs folder using winscp sync.

i made a small test enviroment and generated a complete log and new screenshot.
please see attachment.

You can see that every file "last modified" attribute on target has:

- seconds set to 00
- hours set to +1
  • test-compare.jpg (200.27 KB, Private file)
Description: source and target timestamp compare
  • test-backup-01.log (52.08 KB, Private file)
Description: winscp log

Reply with quote

martin
Site Admin
martin avatar

Re: FTP sync and timestamp

tester.it wrote:

no upload, the need is only to download (mirror) an ftp to a local ntfs folder using winscp sync.
Sorry, but I do not understand. What does the screenshot show? What software is that? How is WinSCP involved?

Reply with quote

Advertisement

martin
Site Admin
martin avatar

OK, what is "source"? The local machine (as the other is "server")? Or the remote machine (as it's the source of the download)? How do the timestamps look like in WinSCP (both panels)? Can you post a screenshot of that?

Reply with quote

tester.it
Joined:
Posts:
6
Location:
Italy

the source is the ftp server (remote, source of download)
the target is the local smb server (local, destination of download)

in attachment site settings and window compare.
  • winscp-settings-1.jpg (222.91 KB, Private file)
Description: winscp site settings
  • winscp-compare-1.jpg (192.75 KB, Private file)
Description: winscp files comparsion

Reply with quote

Advertisement

tester.it
Joined:
Posts:
6
Location:
Italy

correct. settings offset to -1 seem working (dunno why in previous test didnt worked).
thanks.

how to apply offset to my powershell script ?
  • winscp-timezone-offset1.jpg (61.09 KB, Private file)
Description: timezone setting modified

Reply with quote

Advertisement

You can post new topics in this forum