Filter GetFiles() by file name and select one random file.
I am reading the contents of a Directory using VB.net and the FileInfo() and GetFiles commmands.
Dim DirectoryLocation As New IO.DirectoryInfo("c:\somedir")
Dim FileArray As IO.FileInfo() = DirectoryLocation.GetFiles("*.jpg")
Dim FilesInFolder As IO.FileInfo
This code will return several results:
I want to eliminate the files starting with "thumb_" from the list and then select one random file from those results.
I am trying to select a random background image for a webpage from a folder on the server.
I have spent all day on this so far. this code will select a random item from the GetFiles() Array
FileArray(RandString.[Next](0, FileArray.Length)) but before i do that i need to remove the files that contain "thumb" in the file name.
I have tried the FILTER command on the GetFiles() array but i throws an error due to the array type.
any help you can throw my way would be greatly appreciated!