Differences
This shows you the differences between the selected revisions of the page.
| library_example_verify_file_checksum 2017-10-04 | library_example_verify_file_checksum 2022-06-16 (current) | ||
| Line 7: | Line 7: | ||
| To run the script manually use: | To run the script manually use: | ||
| - | <code batch> | + | <code> | 
| - | powershell.exe -File C:\path\VerifyFileChecksum.ps1 -localPath "C:\local\path\file.dat" -remotePath "/remote/path/file.dat" | + | powershell.exe -File C:\path\VerifyFileChecksum.ps1 -sessionUrl "sftp://username:password;fingerprint=ssh-rsa-xxxxxxxxxxx...@example.com/" -localPath "C:\local\path\file.dat" -remotePath "/remote/path/file.dat" | 
| </code> | </code> | ||
| Line 15: | Line 15: | ||
| <code powershell - VerifyFileChecksum.ps1> | <code powershell - VerifyFileChecksum.ps1> | ||
| # @name Verify &Checksum | # @name Verify &Checksum | ||
| - | # @command powershell.exe -ExecutionPolicy Bypass -File "%EXTENSION_PATH%" -sessionUrl "!S" -localPath "!^!" -remotePath "!/!" -pause -sessionLogPath "%SessionLogPath%" | + | # @command powershell.exe -ExecutionPolicy Bypass -File "%EXTENSION_PATH%" ^ | 
| + | # -sessionUrl "!E" -localPath "!^!" -remotePath "!/!" -pause ^ | ||
| + | # -sessionLogPath "%SessionLogPath%" | ||
| # @description Compares checksums of the selected local and remote file | # @description Compares checksums of the selected local and remote file | ||
| # @flag RemoteFiles | # @flag RemoteFiles | ||
| - | # @version 3 | + | # @version 6 | 
| # @homepage ~~SELF~~ | # @homepage ~~SELF~~ | ||
| - | # @require WinSCP 5.8.4 | + | # @require WinSCP 5.16 | 
| # @option SessionLogPath -config sessionlogfile | # @option SessionLogPath -config sessionlogfile | ||
| # @optionspage ~~SELF~~#options | # @optionspage ~~SELF~~#options | ||
| param ( | param ( | ||
| - | # Use Generate URL function to obtain a value for -sessionUrl parameter. | + | # Use Generate Session URL function to obtain a value for -sessionUrl parameter. | 
| - | $sessionUrl = "sftp://user:mypassword;fingerprint=ssh-rsa-xx-xx-xx@example.com/", | + | $sessionUrl = "sftp://user:mypassword;fingerprint=ssh-rsa-xxxxxxxxxxx...@example.com/", | 
| [Parameter(Mandatory = $True)] | [Parameter(Mandatory = $True)] | ||
| $localPath, | $localPath, | ||
| Line 67: | Line 69: | ||
| # Calculate remote file checksum | # Calculate remote file checksum | ||
| - | $remoteChecksum = [System.BitConverter]::ToString($session.CalculateFileChecksum("sha-1", $remotePath)) | + | $remoteChecksumBytes = $session.CalculateFileChecksum("sha-1", $remotePath) | 
| + | $remoteChecksum = [System.BitConverter]::ToString($remoteChecksumBytes) | ||
| Write-Host $remoteChecksum | Write-Host $remoteChecksum | ||
| } | } | ||
| Line 88: | Line 91: | ||
| } | } | ||
| } | } | ||
| - | catch [Exception] | + | catch | 
| { | { | ||
| Write-Host "Error: $($_.Exception.Message)" | Write-Host "Error: $($_.Exception.Message)" | ||
| Line 108: | Line 111: | ||
| In the //Session log file// you can specify a path to a [[logging|session log file]]. | In the //Session log file// you can specify a path to a [[logging|session log file]]. | ||
| + | In the //Keyboard shortcut//, you can specify a [[custom_key_shortcuts|keyboard shortcut]] for the extension. | ||