Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Analysing Subdirectories using GetDirectories or GetFiles

Status
Not open for further replies.

Shake412

Programmer
Apr 17, 2002
55
0
0
GB
Is there any way of analysing a directory using the Directory.GetDirectories class and returning all levels of sub directories as well as the top level?

And/or geting all the files when using the Directory.GetFiles class?

Is the only way to do this, by looping through the directories returned by Directory.GetDirectories and keep moving down a level until there are no further directories?

Any pointers would be welcom

Thanks
 
Thanks for that. I never knew that you could call a procedure from within that very same proceedure. Is that new to .Net or has it always been part of VB.

Thanks again
 
It's called Recursion and has always been a part of VB (at least VB5 and VB6 as that's all I've ever used) as well as most other languages (C, C++, Pascal etc)

However if the nesting is very deep you may run out of stack space so keep the size of any parameters to the function to a minimum (e.g. don't use a path name) as well as keeping variable use within the function to a minimum as well.

Old joke:
Dictionary definition of Recursion:
see Recursion

Regards


Bob Boffin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top