Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't see files on storage card

Status
Not open for further replies.

davidh1111

Programmer
Nov 20, 2003
12
GB
I've got some code that looks for files of a certain type on a pocket pc, and it works fine for files on my device, but for some reason that I can't 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 doesn't seem to throw any exceptions, it just doesn't find it.

Here's 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 I'm looking for...

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

Cheers

Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top