Post a reply

Options
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)

Options

Topic review

bman83

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

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#?
bman83

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