Powershell - kasowanie duplikatów plików w katalogu

Powershell - kasowanie duplikatów plików w katalogu

1
2
3
4
5
6
7
8
9
Get-ChildItem -Path . -File -Recurse | ForEach-Object {
    [PSCustomObject]@{
        Path = $_.FullName
        Hash = Get-FileHash -Path $_.FullName -Algorithm SHA256 | Select-Object -ExpandProperty Hash
        LastWriteTime = $_.LastWriteTime
    }
} | Group-Object -Property Hash | ForEach-Object {
    $_.Group | Sort-Object LastWriteTime -Descending | Select-Object -Skip 1
} | Remove-Item -Force
comments powered by Disqus
Zbudowano z Hugo
Motyw Stack zaprojektowany przez Jimmy