add compare files script
This commit is contained in:
parent
0fc8b61fdc
commit
4a07395cb9
34
Compare-Files.ps1
Normal file
34
Compare-Files.ps1
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# Example usage: Compare-Files.ps1 -filePath1 "C:\Users\dechert\keystores\case-creator-keystore.jks" -filePath2 "C:\Users\dechert\keystores\new\case-creator-keystore.jks"
|
||||||
|
|
||||||
|
param(
|
||||||
|
[string]$filePath1,
|
||||||
|
[string]$filePath2
|
||||||
|
)
|
||||||
|
|
||||||
|
function Compare-Files {
|
||||||
|
param(
|
||||||
|
[string]$path1,
|
||||||
|
[string]$path2
|
||||||
|
)
|
||||||
|
|
||||||
|
$hash1 = Get-FileHash -Path $path1
|
||||||
|
$hash2 = Get-FileHash -Path $path2
|
||||||
|
|
||||||
|
if ($hash1.Hash -eq $hash2.Hash) {
|
||||||
|
Write-Output "Files are identical."
|
||||||
|
} else {
|
||||||
|
Write-Output "Files are not identical."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if both file paths are provided
|
||||||
|
if (-not $filePath1 -or -not $filePath2) {
|
||||||
|
Write-Host "Please provide both file paths."
|
||||||
|
} else {
|
||||||
|
# Check if the files exist
|
||||||
|
if (Test-Path $filePath1 && Test-Path $filePath2) {
|
||||||
|
Compare-Files -path1 $filePath1 -path2 $filePath2
|
||||||
|
} else {
|
||||||
|
Write-Host "One or both of the specified files do not exist."
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user