Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. // OrtizOL - xCSw - http://ortizol.blogspot.com
  2.  
  3. using System;
  4. using System.IO;
  5.  
  6. namespace Receta.CSharp.R0513
  7. {
  8.     public class ComprobacionRutas
  9.     {
  10.         public static void Main(String[] rutas)
  11.         {
  12.             Console.WriteLine(Environment.NewLine);
  13.            
  14.             // Por cada argumento pasado desde la lĂ­nea de comandos
  15.             // se determina si es un directorio o un archivo:
  16.             foreach (string ruta in rutas)
  17.             {
  18.                 Console.Write ("{0}", ruta);
  19.                
  20.                 if (Directory.Exists(ruta))
  21.                 {
  22.                     Console.WriteLine(" es un directorio.");
  23.                 }
  24.                 else if (File.Exists(ruta))
  25.                 {
  26.                     Console.WriteLine(" es un archivo.");
  27.                 }
  28.                 else
  29.                 {
  30.                     Console.WriteLine(" no existe.");
  31.                 }
  32.             }
  33.            
  34.             Console.WriteLine(Environment.NewLine);
  35.         }
  36.     }
  37. }