Solved

return directories and sub directories

Posted on 2003-10-21
5
212 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
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…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

690 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