Post a reply

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

samy

Ok got it, i was missing some arguments.
For those in the same case, here are options needed :
$session.SynchronizeDirectories([WinSCP.SynchronizationMode]::Remote, $Source, $Destination, $True, $False, [Winscp.SynchronizationCriteria]::Time, $transferOptions)

See https://winscp.net/eng/docs/library_session_synchronizedirectories for details.
samy

Powershell script - Exclude directory

Hi!
I'm working on a powershell script that sync remote ftp folder from local windows OS.
However, i'm unable to exclude one local folders from sync.
For example, i try to backup C:\test\backup and exclude C:\test\backup\folder

I put those options
$transferOptions = New-Object WinSCP.TransferOptions

$transferOptions.TransferMode = [WinSCP.TransferMode]::Binary
$transferOptions.FileMask = "*.*| folder/"


And run
$session.SynchronizeDirectories($SyncMode, $SourcePath, $DestinationPath, $True, $transferOptions)


Could u tell me what i'm doing wrong?
Thanks.