Delete a file in a directory using System.IO

Arg81

Well-known member
Joined
Mar 11, 2005
Messages
949
Location
Midlands, UK
Programming Experience
1-3
Hi Guys,

I can do the basic file delete, but I need to work out how to delete a file with a changing part of the filename.

My app creates a PDF called DCList - date_of_creation.pdf i.e. DCList - 01 February 2008.pdf

Any changes made to the data in the database automatically forces the user to re-create this file.
If she edits / adds data on the same date, the file simply overwrites itself.

The bit I'm stumped at is trying to delete the previous day(s) pdf file. There should only ever be 1 PDF file in this folder, so I don't need to delete a lot, just only the one.

Is this something simple to do, and I've just missed the concept??
 
theDate.AddDays(-1) gets you the date of the previous day.
 
Back
Top