DirectoryInfo : Directory : File Directory Stream C# Examples


C# Examples » File Directory Stream » Directory »

 

DirectoryInfo









    
using  System;
using  System.IO;

class  MainClass
{
        public  static  void  Main(string[]  args)
        {
                FileInfo  file  =  new  FileInfo("c:\\test.txt");

                //  Display  directory  information.
                DirectoryInfo  dir  =  file.Directory;

                if  (dir.Exists)
                {
                        Console.Write("Directory  attribute  list:  ");
                        Console.WriteLine(dir.Attributes.ToString());
                        Console.WriteLine("Directory  contains:  "  +  dir.GetFiles().Length.ToString()  +  "  files");
                }

        }
}
    
   
  
   



Output

Directory attribute list: Hidden, System, Directory
Directory contains: 12 files


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo File Directory Stream
» Directory