Exemplo n.º 1
0
 public static void Copy(string sourcePath, string targetPath, bool isOverride)
 {
     if (Directory.Exists(sourcePath))
     {
         DirectoryUtils.CreateDirectoryIfNotExists(targetPath);
         DirectoryInfo directoryInfo = new DirectoryInfo(sourcePath);
         if (directoryInfo.GetFileSystemInfos() != null)
         {
             foreach (FileSystemInfo fileSystemInfo in directoryInfo.GetFileSystemInfos())
             {
                 string destPath = Path.Combine(targetPath, fileSystemInfo.Name);
                 if (fileSystemInfo is FileInfo)
                 {
                     FileUtils.CopyFile(fileSystemInfo.FullName, destPath, isOverride);
                 }
                 else if (fileSystemInfo is DirectoryInfo)
                 {
                     Copy(fileSystemInfo.FullName, destPath, isOverride);
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 public static string[] GetDirectoryPaths(string directoryPath, string searchPattern)
 {
     DirectoryUtils.CreateDirectoryIfNotExists(directoryPath);
     return(Directory.GetDirectories(directoryPath, searchPattern));
 }