Results 1 to 3 of 3

Thread: [RESOLVED] Searching file in my computer

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2012
    Posts
    12

    Resolved [RESOLVED] Searching file in my computer

    Code:
    Dim foundSong As String
            For Each foundSong In My.Computer.FileSystem.GetFiles("Directory", FileIO.SearchOption.SearchAllSubDirectories, "*.mp3*")
                ListBox1.Items.Add(foundSong)
            Next
    im searching mp3 files in my computer with these codes. Question is if the directory would be "C:\". im getting error like program doesnt search "C:\blabla" because its system folder. i dont want to search that system folder , how can i pass that folder to the next folder. i tried try catch but i couldt find any code for the catch part.

    in shortly , on error while searching i want to go next folder.
    (sorry about my english)

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,297

    Re: Searching file in my computer

    If you are searching a root folder that may contain inaccessible subfolders then you cannot use that GetFiles method using SearchAllSubDirectories as the option. You need to write your own recursive file search so that you can Try to check one folder at a time and Catch that exception if it's thrown. There are plenty of examples around of performing a recursive file search.

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2012
    Posts
    12

    Re: Searching file in my computer

    okey.i will try write my own codes for that , if i will be unsuccessed i will search in internet.
    thanks for your reply.
    thank you so much

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width