Why should thisnever happen with Session.SynchronizeDirector

Advertisement

codenat
Joined:
Posts:
12
Location:
Columbia, SC

Why should thisnever happen with Session.SynchronizeDirector

Howdy,
So I am using the .net Assembly for a windows service that synchronizes a folder on the FTP server with a folder on the file share server. I found how to do this here: https://winscp.net/eng/docs/library_session_synchronizedirectories

Near the bottom of the sample code is the following:

        if (e.Touch != null)
        {
            if (e.Touch.Error == null)
            {
                Console.WriteLine("Timestamp of {0} set to {1}", e.Touch.FileName, e.Touch.LastWriteTime);
            }
            else
            {
                Console.WriteLine("Setting timestamp of {0} failed: {1}", e.Touch.FileName, e.Touch.Error);
            }
        }
        else
        {
            // This should never happen with Session.SynchronizeDirectories
            Console.WriteLine("Timestamp of {0} kept with its default (current time)", e.Destination);
        }

I don't understand the comment // This should never happen with Session.SynchronizeDirectories.
Could someone explain to me why this should never happen. It currently happens with my service and I am not sure why it shouldn't.

Thanks for your help!

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: Why should thisnever happen with Session.SynchronizeDirector

Well, it can actually happen, when the server does not support changing remote file timestamp. But that makes the synchronization impossible.

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate log file, set Session.SessionLogPath. Submit the log with your post as an attachment. 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 can mark the attachment as private.

Reply with quote

codenat
Joined:
Posts:
12
Location:
Columbia, SC

Re: Why should thisnever happen with Session.SynchronizeDire

Attached is a log.

I don't know if this is related but the datetime of the file at the end of the process is 4 hours earlier than the current time at the beginning.

If I create a file at 4:00P and then use this program to ftp it, when it ends up in the destination folder, the datetime on the file is 12:00P. If I look at the properties, it says:
created: 30 minutes ago
modified: 5 hours ago
accessed: 30 minutes ago
(see attached jpg)

Thanks for your help
Nat

Description: snippet of file properties

CreatedVSModified4.JPG

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: Why should thisnever happen with Session.SynchronizeDire

You are using "remote to local" synchronization (The .Touch will always be null).

While the example is for "local to remote" synchronization.

I have updated the comment to "This should never happen during "local to remote" synchronization"

Reply with quote

Advertisement

martin
Site Admin
martin avatar

Re: Why should thisnever happen with Session.SynchronizeDire

codenat wrote:

We'll just live with the weird time differences for now.
Not sure how this statement relates.

Reply with quote

codenat
Joined:
Posts:
12
Location:
Columbia, SC

Re: Why should thisnever happen with Session.SynchronizeDire

martin wrote:

codenat wrote:

We'll just live with the weird time differences for now.
Not sure how this statement relates.

codenat wrote:

I don't know if this is related but the datetime of the file at the end of the process is 4 hours earlier than the current time at the beginning.

If I create a file at 4:00P and then use this program to ftp it, when it ends up in the destination folder, the datetime on the file is 12:00P. If I look at the properties, it says:
created: 30 minutes ago
modified: 5 hours ago
accessed: 30 minutes ago
(see attached jpg)

the attached jpg is in above post

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: Why should thisnever happen with Session.SynchronizeDire

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate log file, set Session.SessionLogPath. Submit the log with your post as an attachment. 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 can mark the attachment as private.

Reply with quote

Advertisement

codenat
Joined:
Posts:
12
Location:
Columbia, SC

Re: Why should thisnever happen with Session.SynchronizeDire

martin wrote:

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate log file, set Session.SessionLogPath. Submit the log with your post as an attachment. 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 can mark the attachment as private.

A log was already attached above along with the jpg mentioned that you were asking about.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: Why should thisnever happen with Session.SynchronizeDire

If I create a file at 4:00P and then use this program to ftp it, when it ends up in the destination folder, the datetime on the file is 12:00P.
Do you refer to upload or download? I assume that download, as you do not seem to upload at all.
Can you attach a log file showing two consecutive synchronizations, where at least the first synchronization actually downloads some file (with wrong timestamp) and the second synchronization either downloads the same file or determines that the file does not need synchronization? Please mention a name of the file I should look for in the log file.

Reply with quote

Advertisement

You can post new topics in this forum