کپی محتویات فولدر در  فولدر دیگر
	
	
		سلام
در حال حاضر با دستور زیر توی فایل bat فایل ها رو کپی میکنم، اعم از hide only reading و overwrite  فولدر و ...
xcopy /s /y /h /e /r C:\1 "C:\Program Files (x86)\2"
حالا میخوام اینکار رو با سی شارپ انجام بدم، نمیخوام فایل Bat اجرا بشه و دستور مستقیم تو سی شارپ باشه و پس از اتمام کپی یه پیغام بده در همین حد
	 
	
	
	
		نقل قول: کپی محتویات فولدر در  فولدر دیگر
	
	
		کمک میکنه؟
static void CopyFiles(String pathFrom, String pathTo, Boolean filesOnly){
    foreach(String file in Directory.GetFiles(pathFrom))
    {
        // Copy the current file to the new path. 
        File.Copy(file, Path.Combine(pathTo, Path.GetFileName(file)), true);
        // Get all the directories in the current path. 
        foreach (String directory in Directory.GetDirectories(pathFrom))
        { 
            // If files only is true then recursively get all the files. They will be all put in the original "PathTo" location 
            // without the directories they were in. 
            if (filesOnly)
            {
                // Get the files from the current directory in the loop. 
                CopyFiles(directory, pathTo, filesOnly);
            }
            else
            {
                // Create a new path for the current directory in the new location.                      
                var newDirectory = Path.Combine(pathTo, new DirectoryInfo(directory).Name);
                // Copy the directory over to the new path location if it does not already exist. 
                if (!Directory.Exists(newDirectory))
                {
                    Directory.CreateDirectory(newDirectory);
                }
                // Call this routine again with the new path. 
                CopyFiles(directory, newDirectory, filesOnly);
            }
        }
    }
}