Skip to content

Instantly share code, notes, and snippets.

@elico
Created September 21, 2023 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elico/ab0055052b21c7b8028b2c031bdaf7d9 to your computer and use it in GitHub Desktop.
Save elico/ab0055052b21c7b8028b2c031bdaf7d9 to your computer and use it in GitHub Desktop.
A helper tool to find duplicate files in a folder
$FirstStageFile = "O:\hashes3.csv"
$SecondStageFile = "O:\hashes3-s.csv"
$Directory = "C:\Users\eliezer\Documents\"
Get-ChildItem -Path $Directory -Recurse -File -Force | ForEach {
[PSCustomObject]@{
FullPath = $_.FullName
Name = $_.Name
Size = $_.Length
CreationTime = $_.CreationTime
LastWriteTime = $_.LastWriteTime
Hash = Get-FileHash $_ | Select hash
}
} | Export-Csv -Path $FirstStageFile -NoTypeInformation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment