DriveInfo App : Drive « File Directory Stream « C# / CSharp Tutorial






using System;
using System.Collections.Generic;
using System.Text;
using System.IO;


  class Program
  {
    static void Main(string[] args)
    {
      DriveInfo[] myDrives = DriveInfo.GetDrives();
      foreach (DriveInfo d in myDrives)
      {
        Console.WriteLine("Name: {0}", d.Name);
        Console.WriteLine("Type: {0}", d.DriveType);
        if (d.IsReady)
        {
          Console.WriteLine("Free space: {0}", d.TotalFreeSpace);
          Console.WriteLine("Format: {0}", d.DriveFormat);
          Console.WriteLine("Label: {0}", d.VolumeLabel);
        }
      }
    }
  }








15.14.Drive
15.14.1.List all drives
15.14.2.Get all logical drives
15.14.3.DriveInfo: name, type, format and available free space
15.14.4.DriveInfo App