Sunday, July 4, 2010

Delete Files in C#


I wrote this little application to delete old files in given directories. This application essentially deletes old files, more than x amount of days old. It deletes files in a given list:

foreach (object o in lstDeleteMe.Items)
{
  try
  {
    File.Delete(o.ToString());
  }
    catch (Exception ex) {}
}

No comments:

Post a Comment