Nasir Islam Sujan
Nasir Islam Sujan

Reputation: 372

How to achieve Recycle Bin functionality in WinSCP .NET assembly

I have an application where I'm performing Directory Synchronization between Local and Remote directories using WinSCP .NET assembly.

Now I want to keep overwritten remote files in the Remote recycle bin path e.g. /tmp/trash

I read the documentation for achieving the functionality, and I successfully tested it using the WinSCP GUI application.

Now I need to automate the same functionality through WinSCP .NET assembly.

How can I achieve this?

Upvotes: 0

Views: 177

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202682

Use SessionOptions.AddRawSettings to set DeleteToRecycleBin, OverwrittenToRecycleBin and RecycleBinPath settings:

sessionOptions.AddRawSettings("DeleteToRecycleBin", "1"); // or "on"
sessionOptions.AddRawSettings("OverwrittenToRecycleBin", "1"); // or "on"
sessionOptions.AddRawSettings("RecycleBinPath", "/tmp");

WinSCP GUI can generate such code template for you.

Upvotes: 2

Related Questions