Esempio n. 1
0
 public static void CopyDirectory(string from, string to)
 {
     try {
         if (to [to.Length - 1] != Path.DirectorySeparatorChar)
         {
             to += Path.DirectorySeparatorChar;
         }
         if (!Directory.Exists(to))
         {
             Directory.CreateDirectory(to);
         }
         string[] fileSystemEntries = Directory.GetFileSystemEntries(from);
         for (int i = 0; i < fileSystemEntries.Length; i++)
         {
             string text = fileSystemEntries [i];
             if (Directory.Exists(text))
             {
                 FileTools.CopyDirectory(text, to + Path.GetFileName(text));
             }
             else
             {
                 File.Copy(text, to + Path.GetFileName(text), true);
             }
         }
     }
     catch (Exception ex) {
         Debug.LogError("拷贝文件夹出错" + ex.Message);
     }
 }
Esempio n. 2
0
        public void CopyDirectory(string sourceDirectoryPath, string targetDirectoryPath)
        {
            var sourceDirectory = new DirectoryInfo(sourceDirectoryPath);

            if (!sourceDirectory.Exists)
            {
                Assert.Fail("Source directory not found: " + sourceDirectoryPath);
            }

            var filesToSkip = new List <string> {
                "H_sapiens_Uniprot_trembl_2015-10-14.fasta"
            };

            var targetDirectory = new DirectoryInfo(targetDirectoryPath);

            if (targetDirectory.Exists)
            {
                targetDirectory.Delete(true);
            }

            mFileTools.CopyDirectory(sourceDirectoryPath, targetDirectoryPath, true, filesToSkip);
        }