Reworked MloCombiner
This commit is contained in:
17
MloCombiner/DirectoryInfoExtensions.cs
Normal file
17
MloCombiner/DirectoryInfoExtensions.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user