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.

Options
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)

Options

Topic review

martin

Re: Synchronize local via .NET assembly produces "Nothing to synchronize"

Please post log both from .NET assembly and working log from the script.
danwalker.hecla@gmail.com

Synchronize local via .NET assembly produces "Nothing to synchronize"

Via script, the following sync command works great (just want the directories, no files):
synchronize local C:\Automation\Sync /Automation/Sync/ -filemask="|*"

I am trying to replicate this in PowerShell using the WinSCP .NET assembly:
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.TransferMode = [WinSCP.TransferMode]::Binary
$transferOptions.FileMask = "|*"
 
$synchronizationResult = $session.SynchronizeDirectories(
    [WinSCP.SynchronizationMode]::Local, "C:\Automation\Sync", "/Automation/Sync/", $False, $False, [WinSCP.SynchronizationCriteria]::None, $transferOptions)

When I examine the log file I see this line is produced:
> 2022-05-13 09:17:32.138 Script: synchronize local -nopermissions -preservetime -transfer="binary" -filemask="|*" -criteria="none" -- "C:\Automation\Sync" "/Automation/Sync/"

If I run that command via winscp.com, I get the same "Nothing to synchronize" result.
However, if I remove the double dashes (--), the directory sync works as expected.

How can I get the .NET assembly to perform this directory sync? What did I do wrong?