Differences
This shows you the differences between the selected revisions of the page.
2016-02-23 | 2016-03-31 | ||
System.BitConverter (martin) | turning to an extension (martin) | ||
Line 13: | Line 13: | ||
You can use the script [[guide_custom_commands_automation|from WinSCP GUI as a local custom command]]. | You can use the script [[guide_custom_commands_automation|from WinSCP GUI as a local custom command]]. | ||
- | <code powershell> | + | <code powershell - FindDuplicates.ps1> |
+ | # @name Find &Duplicates | ||
+ | # @command powershell.exe -ExecutionPolicy Bypass -File "%EXTENSION_PATH%" -sessionUrl "!S" -remotePath "!/" -pause | ||
+ | # @description Searches for duplicate files on the server, starting from the current directory | ||
+ | # @flag RemoteFiles | ||
+ | # @version 1 | ||
param ( | param ( | ||
# Use Generate URL function to obtain a value for -sessionUrl parameter. | # Use Generate URL function to obtain a value for -sessionUrl parameter. | ||
Line 20: | Line 26: | ||
$remotePath, | $remotePath, | ||
$remoteChecksumAlg = $Null | $remoteChecksumAlg = $Null | ||
+ | [Switch] | ||
+ | $pause = $False | ||
) | ) | ||
Line 167: | Line 175: | ||
} | } | ||
- | exit 0 | + | $result = 0 |
} | } | ||
catch [Exception] | catch [Exception] | ||
{ | { | ||
Write-Host $_.Exception.Message | Write-Host $_.Exception.Message | ||
- | exit 1 | + | $result = 1 |
} | } | ||
- | </code> | + | |
+ | # Pause if -pause switch was used | ||
+ | if ($pause) | ||
+ | { | ||
+ | Write-Host "Press any key to exit..." | ||
+ | [System.Console]::ReadKey() | Out-Null | ||
+ | } | ||
+ | |||
+ | exit $result | ||
+ | ·</code> | ||