示例#1
0
        public void TestMoveFileSkipperDup()
        {
            var dirs = new DirectoryInfo(@"d:\folder\subfolder");
            var des  = new DirectoryInfo($@"D:\TestFileHandler\FileSkipper");

            foreach (var directoryInfo in des.GetDirectories())
            {
                directoryInfo.Delete(true);
            }

            des.CreateSubdirectory("Source");
            des.CreateSubdirectory("Dest");

            foreach (var fileInfo in dirs.GetFiles())
            {
                fileInfo.CopyTo($@"D:\TestFileHandler\FileSkipper\Source\{fileInfo.Name}", true);
            }

            foreach (var fileInfo in dirs.GetFiles().Where(p => new Random().Next() % 2 == 0))
            {
                fileInfo.CopyTo($@"D:\TestFileHandler\FileSkipper\Dest\{fileInfo.Name}", true);
            }

            IFileHandler fileOverwriter = new FileSkipper <Compress>(@"D:\TestFileHandler\FileSkipper\Source",
                                                                     new List <string> {
                @"D:\TestFileHandler\FileSkipper\Dest"
            }, _pr);

            fileOverwriter.MoveFiles();
            fileOverwriter.DeleteTemps();
        }
示例#2
0
        public void TestMoveFileSkipper()
        {
            Initilize("FileSkipper");
            IFileHandler fileOverwriter = new FileSkipper <Compress>(@"D:\TestFileHandler\FileSkipper\Source",
                                                                     new List <string> {
                @"D:\TestFileHandler\FileSkipper\Dest"
            }, _pr);

            fileOverwriter.MoveFiles();
            fileOverwriter.DeleteTemps();
        }