Any way to clear old log files

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.
 
P

Paul

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,164
Messages
2,570,898
Members
47,440
Latest member
YoungBorel

Latest Threads

Top