Created
June 5, 2017 10:13
-
-
Save AlexSen/02f17fe0b39ae68a76f2ad7fceafe7d3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Get all files/agrs passed to the script | |
$SourceFiles = $PsBoundParameters.Values + $args | |
$FilesInfo = @() | |
ForEach($FileFullPath in $SourceFiles) | |
{ | |
# Get file directory | |
$File = Get-Item -LiteralPath $FileFullPath | |
# Calculate file MD5 | |
$FileMD5info = Get-FileHash $File -Algorithm MD5 | |
# Create MD5 string | |
$MD5String = "$($FileMD5info.Hash)`t$($File.Name)" | |
# Create MD5 file with Hash info | |
$MD5String | Out-File "$($File.FullName).MD5" | |
# Add MD5 String to array | |
$FilesInfo += $MD5String | |
} | |
# Add Files info to clipboard | |
$FilesInfo | clip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment