Robin Weichselbraun 37c33f3e15 initial commit
2025-05-09 14:26:16 +02:00

43 lines
959 B
C#

using System;
using RedundancyFinder;
if (args.Length == 0)
{
Console.WriteLine("No arguments provided.");
return;
}
Finder finder = new Finder();
finder.FindRedundancies(new[] { "D:\\" }, new[] { ".jpg", ".jpeg", ".bmp", ".gif", ".mp4", ".mp3" });
foreach (var redundancy in finder.Redundancies.Values)
{
Console.WriteLine($"Hash: {redundancy.Hash}");
Console.WriteLine("Paths:");
foreach (var path in redundancy.Paths)
{
Console.WriteLine(path);
}
Console.WriteLine();
}
ulong totalSize = finder.Redundancies.Select(x => (ulong)x.Value.FileSize).Aggregate((a, b) => a + b);
string sizeUnit = "B";
while (totalSize > 1024)
{
totalSize /= 1024;
sizeUnit = sizeUnit switch
{
"B" => "KB",
"KB" => "MB",
"MB" => "GB",
"GB" => "TB",
_ => sizeUnit
};
}
Console.WriteLine($"Total Size: {totalSize:.##} {sizeUnit}");