[Csharp]
Using System;
Using System. IO;
Using System. Linq;
Using System. Security. Cryptography;
Using System. Text;
Namespace DupeFinder
{
Internal class Program
{
Private static void Main (string [] args)
{
Directory. GetFiles (@ "d: \ icons", "*. ico ")
. Select (
F => new
{
FileName = f,
FileHash = Encoding. UTF8.GetString (new SHA1Managed ()
. ComputeHash (new FileStream (f,
FileMode. Open,
FileAccess. Read )))
})
. GroupBy (f => f. FileHash)
. Select (g => new {FileHash = g. Key, Files = g. Select (z => z. FileName). ToList ()})
. Selectip (f => f. Files. Skip (1 ))
. ToList ()
. ForEach (File. Delete );
Console. ReadKey ();
}
}
}
Using System;
Using System. IO;
Using System. Linq;
Using System. Security. Cryptography;
Using System. Text;
Namespace DupeFinder
{
Internal class Program
{
Private static void Main (string [] args)
{
Directory. GetFiles (@ "d: \ icons", "*. ico ")
. Select (
F => new
{
FileName = f,
FileHash = Encoding. UTF8.GetString (new SHA1Managed ()
. ComputeHash (new FileStream (f,
FileMode. Open,
FileAccess. Read )))
})
. GroupBy (f => f. FileHash)
. Select (g => new {FileHash = g. Key, Files = g. Select (z => z. FileName). ToList ()})
. Selectip (f => f. Files. Skip (1 ))
. ToList ()
. ForEach (File. Delete );
Console. ReadKey ();
}
}
}
Here's a nifty way to find and delete duplicate files that resulted from extracting all the icon resources embedded in files on your harddrive