troubleshooting Question

Fastest approach to search text in multiple files

Avatar of Manoj Kumbhar
Manoj Kumbhar asked on
Visual Basic.NETGoogleMicrosoft Excel
6 Comments1 Solution178 ViewsLast Modified:
I need to search a string or text in around 2000 files. Input string is coming from an excel document.

Basically I need to search if UserName exists in 2000 excel files placed at shared location. there are around 3000 users for which I need perform this search. I have developed below code by searching on google but it is taking 3 mins for each user which is too long. Please suggest better way.
Public Shared Function Search(ByVal SearchText As String, ByVal FolderPath As String) As List(Of String)

        Dim searchresult As List(Of String) = New List(Of String)
        Dim list As ObjectModel.ReadOnlyCollection(Of String)

        list = My.Computer.FileSystem.FindInFiles(FolderPath, SearchText, True, FileIO.SearchOption.SearchTopLevelOnly)

        searchresult = list.Select(Function(a) a).ToList()
        'For Each name In list
        '    searchresult.Add(name)

        Return searchresult
End Function

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros