short and simple i modified paszt and jm's search algorithm that's been posted on this forum several times to search for files in a folder (and it's sub folders) here's the sub that runs in it's own thread:
the problem is that if i use this with the root drive on my HDD (such as "c:\" or "d:\") the try catch block catches an error saying that it doesnt have the rights to access "d:\systemvolumeinformation" of which i dont need it to access that folder, so how would i modify it to check each folder and see if the program has access to it? if the program doesnt have access to the folder then i need the program to skip that folder
VB.NET:
Private Sub GetArchive(ByVal Src As String)
Dim Files() As String = Directory.GetFileSystemEntries(Src)
For Each element As String In Files
If Directory.Exists(element) = True Then
'if the current FileSystemEntry is a directory, call this function recursively
Call GetArchive(element)
Else
'the current FileSystemEntry is a file so just copy it
Select Case mblnNewArchive
Case True
If element.EndsWith(".m3u") Then
ArchiveList.Add(element)
End If
Case False
If element.EndsWith(".mp3") OrElse element.EndsWith(".mp2") OrElse element.EndsWith(".wma") OrElse element.EndsWith(".wmv") OrElse element.EndsWith(".ogg") OrElse element.EndsWith(".m3u") OrElse element.EndsWith(".pls") Then
ArchiveList.Add(element)
End If
End Select
End If
Next element
End Sub
the problem is that if i use this with the root drive on my HDD (such as "c:\" or "d:\") the try catch block catches an error saying that it doesnt have the rights to access "d:\systemvolumeinformation" of which i dont need it to access that folder, so how would i modify it to check each folder and see if the program has access to it? if the program doesnt have access to the folder then i need the program to skip that folder