Topic "SyncrhonizeDirectories.Removals"

Author Message
calatubo
[View user's profile]

Joined: 2015-02-24
Posts: 8
Hello, I'm using this piece of code

Dim synchronizationResult As SynchronizationResult
synchronizationResult = MySession.SynchronizeDirectories(SynchronizationMode.Remote, local, remote, True, True)
For n = 0 To synchronizationResult.Removals.Count - 1
l.WriteLine("Rimosso " + synchronizationResult.Removals(n).FileName)
Next
For n = 0 To synchronizationResult.Failures.Count - 1
l.WriteLine("Errore " + synchronizationResult.Failures(n).Message)
Next

My intention is to log the files that were been removed due exists in remote and not in local. The list contains the files removed and everything is ok.
If I made the reverse synchronization (SynchronizationMode.Local) the files removed in local due are not present in remote, are not listed in .Removals list. The list is empty every time.
Am I mistake something or is there another metodh to retrive the removed files in this case?

Thanks.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
There's no way to list local removed files.
user2016
[View user's profile]

Joined: 2016-04-21
Posts: 2
IS there any reason why locally removed files could not be listed?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
user2016 wrote:
IS there any reason why locally removed files could not be listed?

Well, it's just not implemented yet.
user2016
[View user's profile]

Joined: 2016-04-21
Posts: 2
prikryl wrote:
user2016 wrote:
IS there any reason why locally removed files could not be listed?

Well, it's just not implemented yet.


Are there any plans when this will be available?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
I'll consider adding it.

But you can implement it as easily as:

Code:
string[] before = Directory.EnumerateFileSystemEntries(localPath, "*", SearchOption.AllDirectories).ToArray();

session.SynchronizeDirectories(...);

string[] after = Directory.EnumerateFileSystemEntries(localPath, "*", SearchOption.AllDirectories).ToArray();

IEnumerable<string> removals = before.Except(after);
calatubo
[View user's profile]

Joined: 2015-02-24
Posts: 8
prikryl wrote:
I'll consider adding it.

But you can implement it as easily as:

Code:
string[] before = Directory.EnumerateFileSystemEntries(localPath, "*", SearchOption.AllDirectories).ToArray();

session.SynchronizeDirectories(...);

string[] after = Directory.EnumerateFileSystemEntries(localPath, "*", SearchOption.AllDirectories).ToArray();

IEnumerable<string> removals = before.Except(after);


Wow, that's great! Thanks.
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