process file-list
This commit is contained in:
parent
ac41f6fe48
commit
f22fedf88c
19
sri.ps1
19
sri.ps1
@ -64,7 +64,7 @@ $hash = hashSHA $hashAlgo
|
||||
if ($directory){
|
||||
# continue only if directory exists, otherwise exit with error
|
||||
if (Test-Path -Path $directory){
|
||||
Write-Host "`nProcessing directory: $directory" -ForegroundColor Cyan
|
||||
Write-Host "Processing directory: $directory" -ForegroundColor Cyan
|
||||
Get-ChildItem -Path $directory -Filter $filter | ForEach-Object({
|
||||
$hashValue = doHash $directory\$_ $hash
|
||||
if ($hashValue -ne 1){
|
||||
@ -82,14 +82,25 @@ if ($directory){
|
||||
|
||||
# process file list, if specified
|
||||
if ($files) {
|
||||
Write-Host
|
||||
Write-Host "Processing files:" -ForegroundColor Cyan
|
||||
foreach ($file in $files) {
|
||||
Write-Host "Processing $file"
|
||||
if (Test-Path -Path $file){
|
||||
$hashValue = doHash $file $hash
|
||||
if ($hashValue -ne 1){
|
||||
Write-Host "$file --> $hashAlgo-$hashValue" -ForegroundColor Green
|
||||
}
|
||||
else {
|
||||
Write-Host "$file --> unable to hash file" -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
else{
|
||||
Write-Host "$file --> cannot find file" -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
Write-Host
|
||||
}
|
||||
|
||||
# clean up and exit
|
||||
Write-Host
|
||||
$hash.Dispose()
|
||||
exit 0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user