FileInfo.Directory : FileInfo « System.IO « C# / C Sharp by API






FileInfo.Directory

 

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");
        }

    }
}

   
  








Related examples in the same category

1.new FileInfo(String fileName)
2.FileInfo.Attributes
3.FileInfo.Create()
4.FileInfo.CreationTime
5.FileInfo.CopyTo(String fileName)
6.FileInfo.Delete
7.FileInfo.FullName
8.FileInfo.LastAccessTime
9.FileInfo.MoveTo(String path)
10.FileInfo.Open
11.FileInfo.OpenRead
12.FileInfo.OpenText
13.FileInfo.OpenWrite()