Home > database >  How to achieve Recycle Bin functionality in WinSCP .NET assembly
How to achieve Recycle Bin functionality in WinSCP .NET assembly

Time:10-25

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?

CodePudding user response:

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.

  • Related