PowerShell: find and remove duplicates

Credit here and here.

gci *.* -recurse | get-filehash -Algorithm MD5 | group -property hash | where {$_.count -gt 1 } `
| % { $_.group | select } | Out-GridView
gci -Recurse
--
gci -Recurse | Get-FileHash -Algorithm MD5
--
Gci -Recurse | Get-FileHash -Algorithm MD5 | Get-Member
--
Gci -Recurse | Get-FileHash -Algorithm MD5 | select -first 1 | Get-Member
--
Gci -Recurse | Get-FileHash -Algorithm MD5 | select -first 1 | Get-Member | Measure-Object
--
Gci -Recurse | Get-FileHash -Algorithm MD5 | group -Property Hash | where {$_.count -gt 1} | % {$_.group | select -Skip 1} | Remove-Item

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s