Can't see files on storage card

davidh

Active member
Joined
Jul 8, 2003
Messages
31
Location
UK
Ok, further to my post from yesterday, Ive got some code that looks for files of a certain type, and it works fine for files on my device, but for some reason that I cant work out it appears to ignore the storage card. If I specify a specific directory on the storage card it works fine, but otherwise it seems to skip it. It doesnt seem to throw any exceptions, it just doesnt find it.

Heres my code...

Code:
Private Sub ListDirectories(ByVal d As DirectoryInfo, ByVal p As String)
        Try
            Report("Dir: " & d.FullName)
        Catch exc As Exception
            MessageBox.Show(exc.Message)
        End Try

        Dim dirs As DirectoryInfo()

        Try
            dirs = d.GetDirectories
        Catch exc As Exception
            MessageBox.Show(exc.Message)
        End Try

        If Not dirs Is Nothing Then
            If dirs.GetUpperBound(0) > 0 Then
                Dim dir As DirectoryInfo
                For Each dir In dirs
                    ListDirectories(dir, p)
                Next dir
            Else
                Report(d.FullName & ": no subdirectories")
            End If
        Else
            Report("No directories " & d.FullName)
        End If

        ListFiles(d, p)
    End Sub

    Private Sub ListFiles(ByVal d As DirectoryInfo, ByVal p As String)
        Dim s As String()

        Try
            s = Directory.GetFiles(d.FullName, p)
        Catch exc As Exception
            MessageBox.Show(exc.Message)
        End Try

        Dim i As Integer

        If Not s Is Nothing Then
            If s.GetLength(0) > 0 Then
                For i = 0 To s.GetUpperBound(0)
                    Try
                        Report("File: " & s(i))
                        lstTours.Items.Add(s(i))
                    Catch exc As Exception
                        MessageBox.Show("File problem: " & exc.Message)
                    End Try
                Next i
            Else
                Report(d.FullName & ": No " & p & " Files")
            End If
        Else
            Report(d.FullName & ": No " & p & " Files")
        End If
    End Sub

If I call
Code:
        Dim di as DirectoryInfo = New DirectoryInfo("\\")
        ListDirectories(di, "*.tga")
it works fine except it ignores the storage card. Similarly if I call
Code:
        Dim di as DirectoryInfo = New DirectoryInfo("\\Storage Card")
        ListDirectories(di, "*.tga")
it still ignores it. But if I call
Code:
        Dim di as DirectoryInfo = New DirectoryInfo("\\Storage Card\\Known Folder")
        ListDirectories(di, "*.tga")
It works fine and finds the files Im looking for...

Any suggestions will be gratefully received cos I think Im going mental...

Cheers

Dave
 
Back
Top