Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > q; files in sub directories

Reply
Thread Tools

q; files in sub directories

 
 
=?Utf-8?B?SklNLkgu?=
Guest
Posts: n/a
 
      09-23-2006

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?

 
Reply With Quote
 
 
 
 
Tim_Mac
Guest
Posts: n/a
 
      09-23-2006
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." <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> 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?
>



 
Reply With Quote
 
 
 
 
=?Utf-8?B?SklNLkgu?=
Guest
Posts: n/a
 
      09-24-2006
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." <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> >
> > 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?
> >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Death To Sub-Sub-Sub-Directories! Lawrence D'Oliveiro Java 92 05-20-2011 06:50 AM
Recognising Sub-Items and sub-sub items using xslt Ben XML 2 09-19-2007 09:35 AM
Extracting Directories and Sub Directories and Counting Ron Smith Perl Misc 5 11-02-2004 11:23 PM
Getting all directories/files from current directory and using -d flag for the directories Adam Petrie Perl Misc 8 10-11-2004 01:28 PM
How to map Project directories to Production sub-directories Joel Finkel ASP .Net 0 09-12-2003 06:47 PM



Advertisments