Topic "How to Sync and Remove using C#"

Author Message
bman83
[View user's profile]

Joined: 2015-11-02
Posts: 2
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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
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
[View user's profile]

Joined: 2015-11-02
Posts: 2
prikryl 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.
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