Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created July 19, 2015 01:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fhernd/3b86602e5590dc42a5bf to your computer and use it in GitHub Desktop.
Save Fhernd/3b86602e5590dc42a5bf to your computer and use it in GitHub Desktop.
Uso de la clase DriveInfo.cs
// OrtizOL - xCSw - http://ortizol.blogspot.com
using System;
using System.IO;
namespace Receta.CSharp.R0516
{
public class UsoDriveInfo
{
public static void Main()
{
Console.WriteLine ();
// Obtención de las unidades actuales en el sistema:
DriveInfo[] unidades = DriveInfo.GetDrives();
// Enlistamiento:
foreach (DriveInfo unidad in unidades)
{
if (unidad.IsReady == true)
{
Console.WriteLine("Letra unidad: {0}", unidad.Name);
Console.WriteLine("Formato unidad: {0}", unidad.DriveFormat);
Console.WriteLine("Nombre volumen: {0}", unidad.VolumeLabel);
Console.WriteLine("Espacio libre: {0}", unidad.AvailableFreeSpace.ToString());
Console.WriteLine ();
}
}
Console.WriteLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment