Using an idea from Bob King idea I wrote the following method.
It works great on CD's, removable drives, regular drives.
However for a floppy it always return "Not Available". Any ideas?
public static void TestFloppy( char driveLetter ) {
using( var searcher = new ManagementObjectSearcher( @"SELECT * FROM Win32_LogicalDisk WHERE DeviceID = '" + driveLetter + ":'" ) )
using( var logicalDisks = searcher.Get() ) {
foreach( ManagementObject logicalDisk in logicalDisks ) {
var fs = logicalDisk[ "FreeSpace" ];
Console.WriteLine( "FreeSpace = " + ( fs ?? "Not Available" ) );
logicalDisk.Dispose();
}
}
}