Public Sub CheckFiles(ByVal TxtToFind As String, ByVal Path As String, ByRef sb As System.Text.StringBuilder, ByVal Filter As String) For Each file As String In Directory.GetFiles(Path, Filter) Dim txt As String = ReadFile(file) If txt.IndexOf(TxtToFind) <> -1 Then sb.AppendLine(file) End If Next For Each dir As String In Directory.GetDirectories(Path) CheckFiles(TxtToFind, dir, sb, Filter) Next End Sub