using System;
using System.IO;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void BtnFind_Click(object sender, EventArgs e)
{
foreach (DriveInfo drive in DriveInfo.GetDrives())
{
if (drive.DriveType.Equals(DriveType.Removable))
{
MessageBox.Show(drive.Name.ToString() + "is an external derive.");
}
else
{
MessageBox.Show("Not external drive avialible");
return;
}
}
}
}
}Through the method GetDriver of DriveInfo class and can get the list of available drives on the computer and also the type , in this example we will try to recognize if the drive and a removable disk drive.
