I have the following code, The problem i am having is its only looking at the root directory and not in the sub-folders within the root directory, how can i change it so it would look into the sub-directory's as well.
DirectoryInfo di = new DirectoryInfo(@"C:\Users\allens\Desktop\test");
DateTime newdate = DateTime.Now.AddHours(-24);
FileInfo[] SWADimg = di.GetFiles("*.jpg");
if (SWADimg.Length == 0)
{
var smtpClient = new SmtpClient
{
Host = "your.company.smtp.server",
UseDefaultCredentials = false,
EnableSsl = true,
Credentials = new NetworkCredential("account_to_use", "password")
};
var message = new MailMessage
{
Subject = "SWAD Error",
Body = "Swad has failed to sync images",
IsBodyHtml = true,
From = new MailAddress("//from email address needed")
};
message.To.Add(new MailAddress("ALL@jnb.com"));
smtpClient.Send(message);
} else
{
Console.WriteLine("no files present");
Console.ReadLine();
}