Skip to content

Instantly share code, notes, and snippets.

@asabla
Last active June 14, 2021 19:23
Show Gist options
  • Save asabla/96f9736a13ff353b35a337609fa07ddc to your computer and use it in GitHub Desktop.
Save asabla/96f9736a13ff353b35a337609fa07ddc to your computer and use it in GitHub Desktop.
Find duplicated files with powershell
Get-ChildItem -Recurse -File |
Group-Object Length |
Where-Object { $_.Count -gt 1 } |
select -ExpandProperty group |
foreach { Get-FileHash -LiteralPath $_.FullName } |
group -Property hash |
where { $_.count -gt 1 } |
select -ExpandProperty group
Get-ChildItem -Recurse -File |
Group-Object Name |
Where-Object { $_.Count -gt 1 } |
Select -ExpandProperty Group |
foreach { Get-FileHash -LiteralPath $_.FullName } |
group -Property hash |
where { $_.count -gt 1 } |
select -ExpandProperty group |
%{ $_.path }
Get-ChildItem -Recurse -File |
Group-Object Name |
Where-Object { $_.Count -gt 1 } |
Select -ExpandProperty Group |
foreach { Get-FileHash -LiteralPath $_.FullName } |
group -Property hash |
where { $_.count -gt 1 } |
select -ExpandProperty group
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment