Advertisement
Alanispw

Untitled

Jun 19th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3.  
  4. namespace PracticandoUno
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9.  
  10. {
  11.  
  12. string arc;
  13.  
  14. Console.WriteLine("Escriba una ruta \n");
  15. arc = Console.ReadLine();
  16.  
  17. try
  18. {
  19. string[] archivos = System.IO.Directory.GetFiles(arc);
  20.  
  21. //recorremos todos los archivos y los escribimos en consola
  22. foreach (var a in archivos)
  23. {
  24. }
  25. }
  26. catch (Exception e)
  27. {
  28. Console.WriteLine(e.Message);
  29. }
  30.  
  31. string dir;
  32. string[] archivo = Directory.GetFiles(arc);
  33. StreamReader leer;
  34. StreamReader leerV = new StreamReader("/Users/alanispw/Desktop/Virus.txt");
  35. string s;
  36.  
  37. s = leerV.ReadLine();
  38.  
  39. while (s != null) {
  40.  
  41. }
  42. /*
  43. foreach (var j in archivo)
  44. {
  45. using (leer = new StreamReader(j)) {
  46.  
  47. while (!leer.EndOfStream)
  48. {
  49.  
  50. dir = leer.ReadLine();
  51.  
  52. Console.WriteLine(dir);
  53.  
  54. // /Users/alanispw/Desktop/queseyo
  55. }
  56. }
  57.  
  58. } */
  59.  
  60.  
  61.  
  62. /* if (archivos.Length == 0)
  63. Console.WriteLine ("No se encontro archivos en" + dir);
  64. else
  65. foreach (string s in archivos)
  66.  
  67. {
  68. Console. WriteLine(s);
  69. try
  70. {
  71. File. Open(s, FileMode.Open, FileAccess.ReadWrite);
  72. }
  73. catch (Exception e)
  74. {
  75. Console. WriteLine(e.Message);
  76. }
  77. } */
  78.  
  79. Console.ReadKey();
  80.  
  81. }
  82.  
  83. }
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement