Deleting files

August 25th, 2008 by Mr.M | No Comments »

I needed to delete some files from a folder on the E:\ drive via SQL. The file name looks like this like this:

20080712_200807131600_KickYourAss.dat

The 1st section shows yyyymmdd, based on that, I parsed out whatever is necessary and nuke anything that’s older than 15 days. In the script, I’ve used (select getdate() – 15), you can also use select dateadd(day, -15, getdate()).

Download Deleting OS files Version v0.1

Leave a Reply

You must be logged in to post a comment.