Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)


Topic review


Exclude Mask not working

This is now working. Reference:

I've changed the following:

$synchronizationResult = $session.SynchronizeDirectories(
    [WinSCP.SynchronizationMode]::Local, $localPath,
    $remotePath, $transferOptions)

$synchronizationResult = $session.SynchronizeDirectories(
    [WinSCP.SynchronizationMode]::Local, $localPath,
    $remotePath, $false, $false, [WinSCP.SynchronizationCriteria]::Time,  $transferOptions)

As mentioned in

Exclude Mask not working

Using WINSCP powershell, I'm trying to download files from SFTP then delete the files from the SFTP source once the files are downloaded.

However, the exclude mask doesn't seem to work. I'm trying to exclude subfolders from the root using the following masks:

CSV files to be downloaded are on /testroot.
I want to exclude the folder /testroot/testarchive and its contents from being downloaded.
However, /testarchive and its contents are still being downloaded.

Snippet of the code:
param (
    $localPath = "C:\summit\FXGo\FileInput\",
    $remotePath = "/testroot/"
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.FileMask = "*.csv|*/"
$session = New-Object WinSCP.Session
    # Connect
    $synchronizationResult = $session.SynchronizeDirectories([WinSCP.SynchronizationMode]::Local, $localPath, $remotePath, $transferOptions)