Created
July 7, 2015 14:38
-
-
Save Fhernd/7cc55e482bf13e6cbcc9 to your computer and use it in GitHub Desktop.
Muestra el tamaño de cada uno de los archivos de
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// OrtizOL - xCSw - http://ortizol.blogspot.com | |
using System; | |
using System.IO; | |
namespace Receta.CSharp.R0504 | |
{ | |
public class CopiarContenidoDirectorio | |
{ | |
public static void Main(string[] args) | |
{ | |
Console.WriteLine(); | |
// Crea una nueva instancia de `DirectoryInfo`: | |
DirectoryInfo directorioC = new DirectoryInfo(@"C:\"); | |
// Arreglo de objetos FileInfo con referencias a | |
// cada archivo del directorio C:\: | |
FileInfo[] archivosC = directorioC.GetFiles(); | |
// Mensaje en pantalla: | |
Console.WriteLine("El directorio {0} contiene los siguientes archivos:", directorioC.Name); | |
foreach (FileInfo archivo in archivosC) | |
{ | |
Console.WriteLine("El tamaño de {0} es {1} bytes.", archivo.Name, archivo.Length); | |
} | |
Console.WriteLine(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment