Skip to content

Instantly share code, notes, and snippets.

@20chan
Created March 28, 2017 06:26
Show Gist options
  • Save 20chan/42e98128feb1d2d8890f63436c6ccf25 to your computer and use it in GitHub Desktop.
Save 20chan/42e98128feb1d2d8890f63436c6ccf25 to your computer and use it in GitHub Desktop.
foreach (string device in System.IO.Directory.GetLogicalDrives())
{
System.IO.DriveInfo dr = new System.IO.DriveInfo(device);
if (dr.DriveType != System.IO.DriveType.Removable) continue;
Console.WriteLine(dr.RootDirectory.ToString());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment