q; files in sub directories

G

Guest

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?
 
T

Tim_Mac

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
 
G

Guest

Thanks I got this working.

Tim_Mac said:
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. said:
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?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top