add compare files script

This commit is contained in:
dechert 2023-12-08 14:45:42 +01:00
parent 0fc8b61fdc
commit 4a07395cb9
2 changed files with 40 additions and 1 deletions

34
Compare-Files.ps1 Normal file
View 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."
}
}

View File

@ -1,3 +1,8 @@
# scripts-n-stuff
Collection of useful powershell and bash scripts
Collection of useful powershell and bash scripts
## Make Scripts executable from everywhere
- notepad $PROFILE
- add: $env:PATH += ";$env:USERPROFILE\Scripts"