Any way to clear old log files

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

Hi I have a console application C# VS2005 that runs remotely and creates a
timestamped log file each time it runs (nightly). I was just wondering if
there is a way to delete only files that are more than 30 days old?
Thanks.
 
Thanks it worked!
--
Paul G
Software engineer.


Mark Rae said:
Point the GetFiles method of the DirectoryInfo class at the folder where the
log files are stored.

Read each file into a FileInfo object and inspect its LastWriteTime
property.
 
Back
Top