new DriveInfo(String fileName) : DriveInfo « System.IO « C# / C Sharp by API






new DriveInfo(String fileName)

  

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

    }
}

   
    
  








Related examples in the same category

1.DriveInfo.AvailableFreeSpace
2.DriveInfo.DriveFormat
3.DriveInfo.DriveType
4.DriveInfo.Name
5.DriveInfo.RootDirectory
6.DriveInfo.TotalFreeSpace
7.DriveInfo.VolumeLabel