Exemple #1
0
        private void ReportAndSuggestWhatDuplicateFilesToDelete(Dictionary <string, List <DuplicateFileInfo> > duplicateFiles, string[] fileLocationsToKeep, string resultFile)
        {
            var duplicateFilesCompare = new DuplicateFilesCompare(fileLocationsToKeep);

            using (var sw = new StreamWriter(resultFile))
            {
                foreach (var files in duplicateFiles.Values)
                {
                    if (files.Count > 1)
                    {
                        files.Sort(duplicateFilesCompare.ComparePaths);
                        for (int i = 0; i < files.Count; i++)
                        {
                            if (i == 0)
                            {
                                sw.WriteLine("REM \"{0}\"", files[i]); //The one to keep
                            }
                            else
                            {
                                sw.WriteLine("del \"{0}\"", files[i]); //The ones to delete
                            }
                        }
                    }
                }
            }
        }
 private void ReportAndSuggestWhatDuplicateFilesToDelete(Dictionary<string, List<DuplicateFileInfo>> duplicateFiles, string[] fileLocationsToKeep, string resultFile)
 {
     var duplicateFilesCompare = new DuplicateFilesCompare(fileLocationsToKeep);
     using (var sw = new StreamWriter(resultFile))
     {
         foreach (var files in duplicateFiles.Values)
         {
             if (files.Count > 1)
             {
                 files.Sort(duplicateFilesCompare.ComparePaths);
                 for (int i = 0; i < files.Count; i++)
                 {
                     if (i == 0)
                     {
                         sw.WriteLine("REM \"{0}\"", files[i]); //The one to keep
                     }
                     else
                     {
                         sw.WriteLine("del \"{0}\"", files[i]); //The ones to delete
                     }
                 }
             }
         }
     }
 }