How to Sync and Remove using C#

Advertisement

bman83
Joined:
Posts:
2

How to Sync and Remove using C#

Hello,

I am trying to find an example of removing files after downloading them using C#.

I have looked at the powershell example and cannot seem to get it to work in C#.

Using session.RemoveFiles works - however if files are being added to the source directory during the download they end up being deleted and not downloaded.

Basically I'm looking to mirror what is done in the powershell example shown here:

https://winscp.net/eng/docs/library_example_delete_after_successful_download

Any suggestions would be appreciated.

Thanks,

Brian

Reply with quote

Advertisement

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

Re: How to Sync and Remove using C#

Cannot you just do with a simple session.GetFiles(source, target, true) ? Note the remove = true argument.

If not, what particular part of the PowerShell code, do you have problems with, translating to C#?

Reply with quote

bman83
Joined:
Posts:
2

Re: How to Sync and Remove using C#

martin wrote:

Cannot you just do with a simple session.GetFiles(source, target, true) ? Note the remove = true argument.

Prikryl,
Thanks for the reply - that's exactly what I was looking for.

Reply with quote

Advertisement

You can post new topics in this forum