Hello all. I am a new returnee to .net after several years in Coldfusion I have forgot a vast majority of what I knew ir thought I new. I have been tasked to build a page or code that looks through a folder for any files created yesterday, then send an e-mail to the area who owns the file.

I have gotten the code to read the files in a folder looking for an ID in the file name. But I am at a loss as to how to just pull files that were created on a specific date. There are 7 years worth of files in the folder so I do not want to got through them all if I can avoid it.

Here is what I have to read the file name....any help is greatly appreciated.

Private Sub loadFiles()
       
        Dim fileCount As Integer = System.IO.Directory.GetFiles("C:\Invoice\", "654444*").Length
        Dim arrFiles() As String = System.IO.Directory.GetFiles("c:\Invoice\", "654444*")
        Dim i As Integer

        For i = 0 To fileCount - 1
            Dim currentFile As String = arrFiles(i)

            ListBox1.Items.Add(currentFile)
        Next

    End Sub


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        ListBox1.Items.Clear()
    End Sub

Have you perhaps tried running a check against File.GetCreationTime for the files in the list to determine the created date for the file(s) against the date range you're targeting?

Hope this helps :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.