Saturday, May 22, 2010

How to get the list of removable drives in c#language?

DriveInfo[] LocalDrives = DriveInfo.GetDrives();


foreach (DriveInfo lDrive in LocalDrives)


{


Console.WriteLine(lDrive.RootDirectory...


Console.WriteLine( "Drive Label : " + lDrive.VolumeLabel);


Console.WriteLine("Type : " + lDrive.DriveType.ToString());


Console.WriteLine("-------------------...


}





the above will print all the drives and its type in the local machine.


this resides on System.IO namespace.





witht the "DriveType" enum we can fine its removable or fixed.





(I Hope this will help)


No comments:

Post a Comment