Post a reply

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)


Topic review


Thank you

Thank you, this information is helpful. Hopefully I can get this working and share my code with the community. Thanks again!

Newbie Help - Delete files older than "n" days using C#

I am looking for some assistance in regards to getting some automated file deletions to occur via a program. To be more specific I am looking to do the following;

1) login to device
2) search for specific filenames older than "n" days;
3) delete files

As I am new to C# I am having some difficulty in understanding how to do this. I am able to successfully login to the appliance in question but I'm lost on how to proceed from here. Is there anyone here that could provide some help or provide some examples on how to do items (2) and (3) as aforementioned above? Thanks!

This code is working for login;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WinSCP;

namespace WinSCPTest
class Program
public static int Main()

// Setup session options
SessionOptions sessionOptions = new SessionOptions
Protocol = Protocol.Sftp,
HostName = "",
UserName = "user",
Password = "yEalB",
SshHostKeyFingerprint = "ssh-rsa 2048 a9:86:dc:0b:8f:e4:70:f1:dc:0d:26:3b:94:4f:52:41"