Drive Type : Drive « File Stream « C# / C Sharp






Drive Type

   

using System;
using System.IO;

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

        // Display drive information.
        DriveInfo drv = new DriveInfo(file.FullName);

        Console.Write("Drive: ");
        Console.WriteLine(drv.Name);

        if (drv.IsReady) {
            Console.Write("Drive type: ");
            Console.WriteLine(drv.DriveType.ToString());
        }
    }
}

   
    
  








Related examples in the same category

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