Advertisement
Fhernd

UsoDriveInfo.cs

Jul 18th, 2015
855
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.02 KB | None | 0 0
  1. // OrtizOL - xCSw - http://ortizol.blogspot.com
  2.  
  3. using System;
  4. using System.IO;
  5.  
  6. namespace Receta.CSharp.R0516
  7. {
  8.     public class UsoDriveInfo
  9.     {
  10.         public static void Main()
  11.         {
  12.             Console.WriteLine ();
  13.            
  14.             // Obtención de las unidades actuales en el sistema:
  15.             DriveInfo[] unidades = DriveInfo.GetDrives();
  16.            
  17.             // Enlistamiento:
  18.             foreach (DriveInfo unidad in unidades)
  19.             {
  20.                 if (unidad.IsReady == true)
  21.                 {
  22.                     Console.WriteLine("Letra unidad:   {0}", unidad.Name);
  23.                     Console.WriteLine("Formato unidad: {0}", unidad.DriveFormat);
  24.                     Console.WriteLine("Nombre volumen: {0}", unidad.VolumeLabel);
  25.                     Console.WriteLine("Espacio libre:  {0}", unidad.AvailableFreeSpace.ToString());
  26.                     Console.WriteLine ();
  27.                 }
  28.             }
  29.            
  30.             Console.WriteLine();
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement