Root Directory : Drive « File Stream « C# / C Sharp






Root Directory

   

using System;
using System.IO;

class MainClass {
    static void Main(string[] args) {
        if (args.Length == 1) {
            DriveInfo drive = new DriveInfo(args[0]);

            Console.Write("Free space in {0}-drive (in kilobytes): ", args[0]);
            Console.WriteLine(drive.AvailableFreeSpace / 1024);
            return;
        }

        foreach (DriveInfo drive in DriveInfo.GetDrives()) {
            Console.WriteLine("{0} - {1} KB",drive.RootDirectory,
                    drive.AvailableFreeSpace / 1024
                    );
        }
    }
}

   
    
  








Related examples in the same category

1.DriveInfo(file.FullName) Name
2.Is Drive Ready
3.Drive Format
4.Available Free Space
5.Drive Type
6.Check drive free space.
7.Provides access to information on a drive.