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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I perform a DIR recursively

Status
Not open for further replies.

Ericthemapper

Technical User
Feb 18, 2003
7
IN
I have a program that checks to see file is a subfolder or file using the DIR command in a Main Folder. I have a DIR inside that loop to check to see if a file is valid using the DIR command but I get an error when doing this.

Is there a way to use a DIR inside my 1st DIR loop or is there a way I can get to see if I have a valid file??

Thanks in Advance!!!

 
Hi Eric,

the problem with Dir is that it'll give you the results when first specifying the path, so using a Dir within a loop which is controlled by a Dir will reset your result set to the new path you're testing. So ss far as I know this wont work. What you *could* do is either use the FileSystemObject or store the results of the *outer* Dir in an array & loop through the array, leaving Dir free for use *within* the loop

HTH

Cheers
Nikki
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top