Archived
Private
Public Access
1
0
This repository has been archived on 2026-02-04. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
FiveMHelper/MloCombiner/DirectoryInfoExtensions.cs
2022-10-26 17:28:27 +02:00

17 lines
787 B
C#

using System.IO;
namespace MloCombiner {
public static class DirectoryInfoExtensions {
public static void CopyFilesRecursively(this DirectoryInfo sourcePath, string targetPath) {
//Now Create all of the directories
foreach (string dirPath in Directory.GetDirectories(sourcePath.FullName, "*", SearchOption.AllDirectories)) {
Directory.CreateDirectory(dirPath.Replace(sourcePath.FullName, targetPath));
}
//Copy all the files & Replaces any files with the same name
foreach (string newPath in Directory.GetFiles(sourcePath.FullName, "*.*", SearchOption.AllDirectories)) {
File.Copy(newPath, newPath.Replace(sourcePath.FullName, targetPath), true);
}
}
}
}