One of the problems I had finding is searching directories for files via user input. Right now I am using a text field to allow users to enter search criteria. I may go to drop downs. The reason I may do this is because the files I am uploading are all being renamed as per the directory structure. (i.e. test.txt would be renamed to asp_ dept_station_1 with the directory structure being c:/asp/dept/station/). Then I just tack on a consecutive number at the end. But I digress. What I have found to be a good way of searching all files in the folders is to loop though all directories and add the files to an array() of type fileinfo. After that, I then loop the array and add the found files to a datalist. I have found this to work pretty well. I am now working on getting the search to allow for more than one word. That is why I may just go to dropdowns. Make sense? Anyway, the code is below for what I am doing currently. I will re-post if I decide to change it. If there are any improvements that can be made, please let me know. Thank you. Now that I think about it, I am using the same code as the post: Recursively Browse Directories Using ASP.NET VB I only added an ‘if’ loop to check for search criteria in filename:
…
If fi.Name.Contains(searchCriteria.ToUpper) Then
filelink = " Server.UrlEncode(dirname) + directorySeparatorChar + Server.UrlEncode(fi.Name) + "&action=download>" + fi.Name + "
"
row = myfiledt.NewRow()
row("filename") = filelink
row("creationtime") = fi.CreationTime
myfiledt.Rows.Add(row)
End If
position += 1 …