Differences

This shows you the differences between the selected revisions of the page.

2022-10-21 2023-05-30
link update (martin) Bug 1892: Support file mask in Keep local directory up to date extension (martin)
Line 21: Line 21:
# @command      powershell.exe -ExecutionPolicy Bypass -File "%EXTENSION_PATH%" ^ # @command      powershell.exe -ExecutionPolicy Bypass -File "%EXTENSION_PATH%" ^
#                  -sessionUrl "!E" -localPath "%LocalPath%" -remotePath "%RemotePath%" ^ #                  -sessionUrl "!E" -localPath "%LocalPath%" -remotePath "%RemotePath%" ^
-#                  %Delete% %Beep% %ContinueOnError% -interval "%Interval%" -pause+#                  %Delete% %Beep% %ContinueOnError% -interval "%Interval%" ^ 
-#                  -sessionLogPath "%SessionLogPath%"+#                  -fileMask "%FileMask%" -pause -sessionLogPath "%SessionLogPath%"
# @description  Periodically scans for changes in a remote directory and ^ # @description  Periodically scans for changes in a remote directory and ^
#                  reflects them on a local directory #                  reflects them on a local directory
-# @version      10+# @version      11
# @homepage    ~~SELF~~ # @homepage    ~~SELF~~
# @require      WinSCP 5.16 # @require      WinSCP 5.16
Line 37: Line 37:
# @option        ContinueOnError -config -run checkbox "Continue on &error" "" -continueOnError # @option        ContinueOnError -config -run checkbox "Continue on &error" "" -continueOnError
# @option        Interval -config -run textbox "&Interval (in seconds):" "30" # @option        Interval -config -run textbox "&Interval (in seconds):" "30"
 +# @option        FileMask -config -run textbox "File &mask:" ""
# @option      - -config group "Logging" # @option      - -config group "Logging"
# @option        SessionLogPath -config sessionlogfile # @option        SessionLogPath -config sessionlogfile
Line 57: Line 58:
    $sessionLogPath = $Null,     $sessionLogPath = $Null,
    $interval = 30,     $interval = 30,
 +    $fileMask = $Null,
    [Switch]     [Switch]
    $pause     $pause
Line 100: Line 102:
    $sessionOptions = New-Object WinSCP.SessionOptions     $sessionOptions = New-Object WinSCP.SessionOptions
    $sessionOptions.ParseUrl($sessionUrl)     $sessionOptions.ParseUrl($sessionUrl)
 +
 +    $transferOptions = New-Object WinSCP.TransferOptions -Property @{ FileMask = $fileMask };
    $session = New-Object WinSCP.Session     $session = New-Object WinSCP.Session
Line 119: Line 123:
                $differences =                 $differences =
                    $session.CompareDirectories(                     $session.CompareDirectories(
-                        [WinSCP.SynchronizationMode]::Local, $localPath, $remotePath, $delete)+                        [WinSCP.SynchronizationMode]::Local, $localPath, $remotePath, $delete
 +                        $False, [WinSCP.SynchronizationCriteria]::Time, $transferOptions)
                Write-Host                 Write-Host
Line 156: Line 161:
                        try                         try
                        {                         {
-                            $difference.Resolve($session) | Out-Null+                            $difference.Resolve($session, $transferOptions) | Out-Null
                            Write-Host " Done."                             Write-Host " Done."
                        }                         }
Line 226: Line 231:
In the //Interval// box, specify an interval between the checks for changes. In the //Interval// box, specify an interval between the checks for changes.
 +
 +In the //File mask// box, you can specify [[file_mask|file mask]] to select/deselect files (or file types) and directories for the synchronization. &future_feature
In the //Session log file//, you can specify a path to a [[logging|session log file]]. The option is available on the [[ui_pref_commands|Preferences dialog]] only. In the //Session log file//, you can specify a path to a [[logging|session log file]]. The option is available on the [[ui_pref_commands|Preferences dialog]] only.

Last modified: by martin