q; files in sub directories

Discussion in 'ASP .Net' started by =?Utf-8?B?SklNLkgu?=, Sep 23, 2006.

  1. private void getList()
    {
    string[] fList = Directory.GetFiles("c:\\Tmp");
    listBox.DataSource = fList;
    listBox.DataBind();
    }


    This codes brings all the files in the folder c:\tmp. How can make this code
    return all the files in the sub directories too?
     
    =?Utf-8?B?SklNLkgu?=, Sep 23, 2006
    #1
    1. Advertising

  2. =?Utf-8?B?SklNLkgu?=

    Tim_Mac Guest

    hi Jim,
    the Directory.GetFiles() method in .Net 1.1 does not have the 'include
    subdirectories' option you describe. The version in .Net 2.0 does include
    this option as a 3rd parameter.

    you could easily write your own using a recursive function with a few lines
    of code. if this poses a problem let me know,
    tim


    "JIM.H." <> wrote in message
    news:...
    >
    > private void getList()
    > {
    > string[] fList = Directory.GetFiles("c:\\Tmp");
    > listBox.DataSource = fList;
    > listBox.DataBind();
    > }
    >
    >
    > This codes brings all the files in the folder c:\tmp. How can make this
    > code
    > return all the files in the sub directories too?
    >
     
    Tim_Mac, Sep 23, 2006
    #2
    1. Advertising

  3. Thanks I got this working.

    "Tim_Mac" wrote:

    > hi Jim,
    > the Directory.GetFiles() method in .Net 1.1 does not have the 'include
    > subdirectories' option you describe. The version in .Net 2.0 does include
    > this option as a 3rd parameter.
    >
    > you could easily write your own using a recursive function with a few lines
    > of code. if this poses a problem let me know,
    > tim
    >
    >
    > "JIM.H." <> wrote in message
    > news:...
    > >
    > > private void getList()
    > > {
    > > string[] fList = Directory.GetFiles("c:\\Tmp");
    > > listBox.DataSource = fList;
    > > listBox.DataBind();
    > > }
    > >
    > >
    > > This codes brings all the files in the folder c:\tmp. How can make this
    > > code
    > > return all the files in the sub directories too?
    > >

    >
    >
    >
     
    =?Utf-8?B?SklNLkgu?=, Sep 24, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joel Finkel
    Replies:
    0
    Views:
    500
    Joel Finkel
    Sep 12, 2003
  2. Ben
    Replies:
    2
    Views:
    930
  3. Lawrence D'Oliveiro

    Death To Sub-Sub-Sub-Directories!

    Lawrence D'Oliveiro, May 5, 2011, in forum: Java
    Replies:
    92
    Views:
    2,101
    Lawrence D'Oliveiro
    May 20, 2011
  4. Adam Petrie
    Replies:
    8
    Views:
    322
    Adam Petrie
    Oct 11, 2004
  5. Ron Smith
    Replies:
    5
    Views:
    156
    Michele Dondi
    Nov 2, 2004
Loading...

Share This Page