Esempio n. 1
0
    public void CopyFiles(IOSearchPattern source, FileSystemPath destination, bool replaceExistingFiles)
    {
        // Copy each file
        foreach (FileSystemPath file in Directory.GetFiles(source.DirPath, source.SearchPattern, source.SearchOption))
        {
            // Get the destination file
            var destFile = destination + (file - source.DirPath);

            // Skip if the file already exists and we should not replace it
            if (destFile.FileExists && !replaceExistingFiles)
            {
                continue;
            }

            // Move the file
            CopyFile(file, destFile, true);
        }

        Logger.Debug("The files from {0} were copied to {1}", source.DirPath, destination);
    }
Esempio n. 2
0
 private static DateTime GetLastWriteTime(IOSearchPattern dir) => dir.GetFiles().
 Select(x => new FileInfo(x).LastWriteTime).
 OrderByDescending(x => x).
 FirstOrDefault();
Esempio n. 3
0
 /// <summary>
 /// Constructor with parameters for a search pattern
 /// </summary>
 /// <param name="searchPattern">The search pattern</param>
 public ProgressionDirectory(IOSearchPattern searchPattern) : this(searchPattern.DirPath, searchPattern.SearchOption, searchPattern.SearchPattern)
 {
 }