Last active
April 7, 2021 19:44
-
-
Save symonerandle/59c388cf4c0de45c7857f9b01db7e576 to your computer and use it in GitHub Desktop.
PowerShell: File management script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<--! | |
Usecase: List duplicate files in directory. | |
--> | |
Get-ChildItem -Recurse | | |
Group-Object Length | | |
Where-Object { $_.Count -gt 1 } | | |
Select-Object -ExpandProperty Group | | |
ForEach-Object { Get-FileHash -LiteralPath $_.FullName } | | |
Group-Object -Property Hash | | |
Where-Object { $_.Count -gt 1} | | |
Select-Object -ExpandProperty Group | | |
Select-Object Hash, Path | |
Out-File folder\nestedFolder\textFile.txt -Width 510 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment