Solved

return directories and sub directories

Posted on 2003-10-21
5
210 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

856 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