Solved

return directories and sub directories

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

932 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

12 Experts available now in Live!

Get 1:1 Help Now