Advertisement
Guest User

Untitled

a guest
Jul 15th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.IO;
  7.  
  8. namespace ConsoleApp1
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. Console.Write("Write the path of the old file folder: ");
  15. string path = Console.ReadLine();
  16.  
  17.  
  18.  
  19. Console.Write("Write the path of the new file folder: ");
  20.  
  21. string pathTwo = Console.ReadLine();
  22. listFilesFromDirectory(path, pathTwo);
  23. Console.WriteLine("Press Enter to continue:");
  24. Console.Read();
  25. }
  26. static void listFilesFromDirectory(string workingDirectory, string workingDirectoryTwo)
  27. {
  28. // get a list of files in a directory,
  29. // based upon a path that is passed into the function
  30. string[] filePaths = Directory.GetFiles(workingDirectory);
  31. foreach (string filePath in filePaths)
  32. {
  33. // use the foreach loop to go through the entire
  34. // array one element at a time write out
  35. // the full path and file name of each of the
  36. // elements in the array
  37. Console.WriteLine(filePath);
  38. string oldfile = (filePath);
  39. string[] filePathsTwo = Directory.GetFiles(workingDirectoryTwo);
  40. foreach (string filePathTwo in filePathsTwo)
  41. {
  42. // use the foreach loop to go through the entire
  43. // array one element at a time write out
  44. // the full path and file name of each of the
  45. // elements in the array
  46. Console.WriteLine(filePathTwo);
  47. string newfile = (filePathTwo);
  48.  
  49. }
  50.  
  51.  
  52.  
  53.  
  54. }
  55.  
  56.  
  57.  
  58.  
  59.  
  60. }
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement