tags:

views:

562

answers:

4

Are there any C# open-source components that allow me to delete files via SFTP?

+1  A: 

Try SharpSSH.

jasonh
A: 

Not open source, but you could try edtFTPnet/PRO, which supports all SFTP operations including deleting of files.

As jasonh says, granados does SSH, not SFTP.

Bruce Blackshaw
A: 

You can use OpenSSH and issue sftp batch commands. All you have to do on the c# side is launch the sftp process with the correct command line.

omellet
A: 

Tamir Gal's Sharp SSH is quite popular open source implementation of SFTP for .NET. Give it a try.

If you preffer fully supported commercial component can try our Rebex SFTP. Following code ilustrates the concept:

using Rebex.Net;

// create client and connect  
Sftp client = new Sftp();
client.Connect(hostname);
client.Login(username, password);

// delete the file
client.DeleteFile("/path/to/the/file");

// disconnect  
client.Disconnect();
Martin Vobr
Martin, please disclose your affiliation in each post where you mention your own products. I know you're not trying anything shady, this is just the policy that we're asking everyone to adhere to. Please see the [FAQ](http://stackoverflow.com/faq) for the official policy statement. Thanks.
Bill the Lizard
Sure, no problem. I've added a magical 'our' word to this post (and to other posts too).
Martin Vobr