Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.IO;
- namespace ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.Write("Write the path of the old file folder: ");
- string path = Console.ReadLine();
- Console.Write("Write the path of the new file folder: ");
- string pathTwo = Console.ReadLine();
- listFilesFromDirectory(path, pathTwo);
- Console.WriteLine("Press Enter to continue:");
- Console.Read();
- }
- static void listFilesFromDirectory(string workingDirectory, string workingDirectoryTwo)
- {
- // get a list of files in a directory,
- // based upon a path that is passed into the function
- string[] filePaths = Directory.GetFiles(workingDirectory);
- foreach (string filePath in filePaths)
- {
- // use the foreach loop to go through the entire
- // array one element at a time write out
- // the full path and file name of each of the
- // elements in the array
- Console.WriteLine(filePath);
- string oldfile = (filePath);
- string[] filePathsTwo = Directory.GetFiles(workingDirectoryTwo);
- foreach (string filePathTwo in filePathsTwo)
- {
- // use the foreach loop to go through the entire
- // array one element at a time write out
- // the full path and file name of each of the
- // elements in the array
- Console.WriteLine(filePathTwo);
- string newfile = (filePathTwo);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement