Topic "Why should thisnever happen with Session.SynchronizeDirector"

Author Message
codenat
[View user's profile]

Joined: 2015-03-23
Posts: 12
Location: Columbia, SC
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:

Code:
        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!
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
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.
_________________
Martin Prikryl
codenat
[View user's profile]

Joined: 2015-03-23
Posts: 12
Location: Columbia, SC
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
CreatedVSModified4.JPG (14.92 KB)

Description: snippet of file properties

CreatedVSModified4.JPG

150326Log.log (110.47 KB) [Download]

Description: (none)

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
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"
_________________
Martin Prikryl
codenat
[View user's profile]

Joined: 2015-03-23
Posts: 12
Location: Columbia, SC
Many thanks!!

We'll just live with the weird time differences for now.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
codenat wrote:
We'll just live with the weird time differences for now.

Not sure how this statement relates.
_________________
Martin Prikryl
codenat
[View user's profile]

Joined: 2015-03-23
Posts: 12
Location: Columbia, SC
prikryl 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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
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.
codenat
[View user's profile]

Joined: 2015-03-23
Posts: 12
Location: Columbia, SC
test
codenat
[View user's profile]

Joined: 2015-03-23
Posts: 12
Location: Columbia, SC
prikryl 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.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Quote:
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.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License