DriveInfo.RootDirectory : DriveInfo « System.IO « C# / C Sharp by API






DriveInfo.RootDirectory

 


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.new DriveInfo(String fileName)
2.DriveInfo.AvailableFreeSpace
3.DriveInfo.DriveFormat
4.DriveInfo.DriveType
5.DriveInfo.Name
6.DriveInfo.TotalFreeSpace
7.DriveInfo.VolumeLabel