Results 1 to 2 of 2

Thread: Get all files from sub folders

  1. #1
    Addicted Member
    Join Date
    Apr 12
    Posts
    152

    Get all files from sub folders

    I have this code to get files from a folder location on my hard drive.

    How can I get all files from sub folders in this folder?

    vb.net Code:
    1. Dim FileLocation As String = "C:\MyFiles\"
    2.             Dim di As New IO.DirectoryInfo(FileLocation)
    3.             Dim Files As IO.FileInfo() = di.GetFiles()

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 02
    Posts
    21,794

    Re: Get all files from sub folders

    By using the documentation and seeing that there is an overload version of GetFiles that
    Quote Originally Posted by MSDN
    specifies whether the search operation should include only the current directory or all subdirectories.
    And it too comes with its own documentation as well.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.-I also subscribe to all threads I participate, so there's no need to pm when there's an update.*
    *Proof positive that searching the forums does work: View Thread *
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *
    * Use Offensive Programming, not Defensive Programming. * On Error Resume Next is error ignoring, not error handling(tm).
    "There is a major problem with your code, and VB wants to tell you what it is.. but you have decided to put your fingers in your ears and shout 'I'm not listening!'" - si_the_geek on using OERN

Posting Permissions

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