Hi guys,
I was just wondering what the best way to go about this was. I am using .net cf 2.0 and i need to delete any photos that were created over 2 weeks ago.
The code i am using at the moment is:
VB Code:
Dim allPhotos() As String = IO.Directory.GetFiles(SYS_PHOTO_DIRECTORY) Dim dt As DateTime Dim fourteenDays as Integer = 14 'This is actually declared as a global variable as it will be used for other areas of my program. For i As Integer = 0 To allPhotos.GetUpperBound(0) Step 1 dt = File.GetCreationTime(allPhotos(i)).ToLongDateString If dt < Date.Now.AddDays(-(fourteenDays)) Then File.Delete(allPhotos(i)) End If Next
and i was just wondering two things:
1) will this delete photos 13 days old or 14 days old
2)is this the best way to do this?




Reply With Quote