Get files in folder and the date in vb.net

I’m using this in a project that monitor files on a server folder.
This folder contains any failures that have not processed on the server.
I then display this on a screen with the filename and date to make sure we know what it is and the time it happened.

           Dim files() As String = IO.Directory.GetFiles("X:\Path\To\Files")

            For Each file As String In files

                'Get the date and time modified of this file
                FDate = IO.File.GetLastWriteTime(file)
                'tidy the filename up by removing the .ext of the name
                file = Replace(file, ".ext", "")


                testBox.Text = testBox.Text + file + " " + FDate + Environment.NewLine

            Next

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.