Solved

return directories and sub directories

Posted on 2003-10-21
5
209 Views
Last Modified: 2010-04-16
i wanna create a function that returns all directories and sub directories in a given path could i find help here
0
Comment
Question by:hema_jone_mickey
  • 3
  • 2
5 Comments
 
LVL 7

Expert Comment

by:psdavis
ID: 9592912
Check out the File and Path classes to start with.  Let me see what else is available.

0
 
LVL 7

Accepted Solution

by:
psdavis earned 20 total points
ID: 9592917
Ah, here ya go.  The Directory class.

         string[] strFiles = Directory.GetFiles( @"C:\" ).
0
 
LVL 7

Expert Comment

by:psdavis
ID: 9592940

public void ListDirectory( string strPathName )
{
   Console.Output( "Directory: " + strPathName );

   string[] strDirectories = Directory.GetDirectories( strPathName );

   foreach( string strDirectory in strDirectories )
   {
      ListDirectory( strDirectory );
   }
}

0
 

Author Comment

by:hema_jone_mickey
ID: 9593158
thanks for all .with just small amount of thinking    thnaks Psdavis)
i figured the solution
public ArrayList directories=new ArrayList();
void getAlldir(string dir)
            {
                  string [] dirs =Directory.GetDirectories(dir);
                  if(dirs.Length!=0)
                  {
                        for(int i=0;i<dirs.Length;i++)
                              directories.Add(dirs[i]);
                        
                        for(int j=0;j<dirs.Length;j++)
                              getAlldir(dirs[j]);
                  }
            }
0
 

Author Comment

by:hema_jone_mickey
ID: 9594177
but the proplem i wanna add this files in a zip file
i'm using ICSharp.Nzip.zip
but it doesn't add all of them does any one knows how to accomplish that
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now