46 lines
1.3 KiB
C#
46 lines
1.3 KiB
C#
using System;
|
|
using System.IO;
|
|
|
|
namespace PDFFolderComparer
|
|
{
|
|
class Program
|
|
{
|
|
|
|
static void Main(string[] args)
|
|
{
|
|
if (args.Length != 2) return;
|
|
|
|
DirectoryInfo folderA = new DirectoryInfo(args[0]);
|
|
DirectoryInfo folderB = new DirectoryInfo(args[1]);
|
|
CompareFolders(folderA, folderB);
|
|
CompareFolders(folderB, folderA, true);
|
|
|
|
Console.WriteLine("Hello World!");
|
|
Console.ReadKey();
|
|
}
|
|
|
|
private static void CompareFolders(DirectoryInfo folderA, DirectoryInfo folderB, bool onlyMissing = false)
|
|
{
|
|
foreach (FileInfo fileA in folderA.GetFiles())
|
|
{
|
|
if (folderB.GetFiles(fileA.Name).Length == 0)
|
|
{
|
|
Console.WriteLine(String.Concat("Missing file: ", fileA));
|
|
}
|
|
else if (!onlyMissing)
|
|
{
|
|
|
|
foreach (FileInfo fileB in folderB.GetFiles(fileA.Name))
|
|
{
|
|
|
|
if (fileA.Length != fileB.Length)
|
|
{
|
|
Console.WriteLine(String.Concat("Files are different: ", fileA));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|