Post a reply

Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)


Topic review


Thanks, Martin!

I have missed the word "remote" :D

Re: SynchronizeDirectories returns empty collection in SynchronizationResult.Removals

As the documentated, the SynchronizationResult.Removals is "Collection of remote file removals".
Local file removals are not returned currently.

See this example how to find list of removed files yourself (it's in PowerShell though):
(see the "scan for removed local files" section of the code)

SynchronizeDirectories returns empty collection in SynchronizationResult.Removals

First, thanks for your software! :)

I am using SynchronizeDirectories to sync local files to Ubuntu server, and vica versa using SFTP Protocol. When syncing to SFTP server, the SynchronizationResult.Removals have list of removed files. When syncing from SFTP server to local, the Removals are empty list.

I have reduced this to very simple test case. One side has an empty folder, other - one file. I have enabled logging, and also capturing .xml file by placing break-point at XML file deleting in Session.cs file:
Logger.WriteLine("Deleting XML log file [{0}]", XmlLogPath);


When syncing from local to SFTP, the XML file looks like this:
<?xml version="1.0" encoding="UTF-8"?>

<session xmlns="" name="MY_SERVER_NAME" start="2019-07-18T13:36:17.488Z">
  <group name="sftp://ubuntu@MY_SERVER_NAME:22 -hostkey=&quot;ssh-rsa 2048 *************************=&quot; -privatekey=&quot;C:\key.ppk&quot; -timeout=60 -passphrase=***" start="2019-07-18T13:36:20.219Z">
  <group name="" start="2019-07-18T13:36:21.029Z">
      <cwd value="/home/ubuntu" />
      <result success="true" />
  <group name="remote -delete  -nopermissions -preservetime -transfer=&quot;binary&quot; -resumesupport=&quot;off&quot; -criteria=&quot;either&quot;  -- &quot;c:\test case\&quot; &quot;/home/ubuntu/the test directory/&quot;" start="2019-07-18T13:36:21.108Z">
      <filename value="/home/ubuntu/the test directory/first file.txt" />
      <result success="true" />
  <group name="" start="2019-07-18T13:36:21.942Z">

There is entry rm in the XML file, and SynchronizationResult.Removals have one entry. So far so good. Now I try sync in other direction. Capturing XML file:
<?xml version="1.0" encoding="UTF-8"?>

<session xmlns="" name="ubuntu@MY_SERVER_NAME" start="2019-07-18T13:06:40.914Z">
  <group name="sftp://ubuntu@MY_SERVER_NAME:22 -hostkey=&quot;ssh-rsa 2048 *************************=&quot; -privatekey=&quot;C:\some_key.ppk&quot; -timeout=60 -passphrase=***" start="2019-07-18T13:06:43.509Z">
  <group name="" start="2019-07-18T13:06:43.611Z">
      <cwd value="/home/ubuntu" />
      <result success="true" />
  <group name="local -delete  -nopermissions -preservetime -transfer=&quot;binary&quot; -resumesupport=&quot;off&quot; -criteria=&quot;either&quot;  -- &quot;c:\test case\&quot; &quot;/home/ubuntu/the test directory/&quot;" start="2019-07-18T13:06:43.692Z">
  <group name="" start="2019-07-18T13:06:44.555Z">

There is no entry for rm, and Removals are also empty. However, the file is synced correctly (deleted), and other log file also have clue that file was deleted:
> 2019-07-18 16:06:44.067 Type: SSH_FXP_CLOSE, Size: 13, Number: 1028

> 2019-07-18 16:06:44.067 04,00,00,04,04,00,00,00,04,00,00,00,00,
. 2019-07-18 16:06:44.067 Sent 17 bytes
. 2019-07-18 16:06:44.067 There are 0 bytes remaining in the send buffer
. 2019-07-18 16:06:44.067 Looking for network events
. 2019-07-18 16:06:44.067 Timeout waiting for network events
. 2019-07-18 16:06:44.067 .;d;0;2019-07-18T13:02:37.000Z;3;"ubuntu" [1000];"ubuntu" [1000];rwxrwxr-x;0
. 2019-07-18 16:06:44.067 ..;d;0;2019-07-18T13:02:37.000Z;3;"ubuntu" [1000];"ubuntu" [1000];rwxr-xr-x;0
. 2019-07-18 16:06:44.067 Local file 'c:\test case\first file.txt' [2019-07-18T13:06:33.882Z] [1] is new
< 2019-07-18 16:06:44.067 Script: Synchronizing...
. 2019-07-18 16:06:44.067 Synchronizing local directory 'c:\test case\' with remote directory '/home/ubuntu/the test directory/', params = 0x403 (Delete, NoConfirmation, BySize)
< 2019-07-18 16:06:44.068 Script: Local 'c:\test case' <= Remote '/home/ubuntu/the test directory'
< 2019-07-18 16:06:44.140 Script: 'c:\test case\first file.txt' deleted
. 2019-07-18 16:06:44.187 Session upkeep
. 2019-07-18 16:06:44.187 Looking for network events
. 2019-07-18 16:06:44.187 Detected network event
. 2019-07-18 16:06:44.187 Enumerating network events for socket 1324
. 2019-07-18 16:06:44.187 Enumerated 1 network events making 1 cumulative events for socket 1324
. 2019-07-18 16:06:44.187 Handling network read event on socket 1324 with error 0
. 2019-07-18 16:06:44.187 Received 28 bytes (0)
> 2019-07-18 16:06:44.555 Script: exit
. 2019-07-18 16:06:44.555 Session upkeep

Am I doing something wrong? If you need more information, I will gladly provide it.

Thanks in advance! :)