SyncrhonizeDirectories.Removals

Advertisement

calatubo
Joined:
Posts:
8

SyncrhonizeDirectories.Removals

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.

Reply with quote E-mail

Advertisement

martin
Site Admin
martin avatar

user2016 wrote:

IS there any reason why locally removed files could not be listed?
Well, it's just not implemented yet.

Reply with quote

user2016
Joined:
Posts:
2

martin 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?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,442
Location:
Prague, Czechia

Re: SyncrhonizeDirectories.Removals

I'll consider adding it.

But you can implement it as easily as:

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

session.SynchronizeDirectories(...);

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

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

Reply with quote

calatubo
Joined:
Posts:
8

Re: SyncrhonizeDirectories.Removals

martin wrote:

I'll consider adding it.

But you can implement it as easily as:

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.

Reply with quote E-mail

Advertisement

You can post new topics in this forum