Delete files from the folder older than 4 days
I would like to run a timer for every 5 hours and delete the files from the folder older than 4 days. Could you please with sample code? Robert Venables Since it hasn't been mentioned, I would recommend using a System.Threading.Timer for something like this. Here's an example implementation: System.Threading.Timer DeleteFileTimer = null; private void CreateStartTimer() { TimeSpan InitialInterval = new TimeSpan(0,0,5); TimeSpan RegularInterval = new TimeSpan(5,0,0); DeleteFileTimer = new System.Threading.Timer(QueryDeleteFiles, null, InitialInterval, RegularInterval); } private void