From 4a07395cb9643968e3ec62f569d1a30fb5f66678 Mon Sep 17 00:00:00 2001 From: dechert Date: Fri, 8 Dec 2023 14:45:42 +0100 Subject: [PATCH] add compare files script --- Compare-Files.ps1 | 34 ++++++++++++++++++++++++++++++++++ README.md | 7 ++++++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 Compare-Files.ps1 diff --git a/Compare-Files.ps1 b/Compare-Files.ps1 new file mode 100644 index 0000000..985dee6 --- /dev/null +++ b/Compare-Files.ps1 @@ -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." + } +} diff --git a/README.md b/README.md index ce79622..a2274f2 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ # scripts-n-stuff -Collection of useful powershell and bash scripts \ No newline at end of file +Collection of useful powershell and bash scripts + +## Make Scripts executable from everywhere + + - notepad $PROFILE + - add: $env:PATH += ";$env:USERPROFILE\Scripts"