publicstaticvoidCopyEntireDir(string SourcePath,string CopyToPath){//Now Create all of the directoriesvar path = Directory.GetDirectories(SourcePath,"*", SearchOption.AllDirectories);foreach(string dirPath in Directory.GetDirectories(SourcePath,"*", SearchOption.AllDirectories)){
Directory.CreateDirectory(dirPath.Replace(SourcePath, CopyToPath));}//Copy all the files & Replaces any files with the same nameforeach(string newPath in Directory.GetFiles(SourcePath,"*.*", SearchOption.AllDirectories)){if(newPath.EndsWith(".meta")|| newPath.EndsWith(".bak")){continue;}
File.Copy(newPath, newPath.Replace(SourcePath, CopyToPath),true);}}