Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I need to access all files in a given directory and all subdirectories. So I write a sub with Dir that is calling itself with recursion. The problem is that inside calls to Dir screw outside calls Dir, so that when I go back in recusion my Dir is reset.

How should I approach this task?

  • *Experts*
Posted

Don't use Dir. :)

 

Use System.IO.Directory.GetFiles() to retrieve a list of all the files in a directory and .GetDirectories() to get the directories.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...