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

bartplessers

PowerShell $transferOptions.FileMask not working

Hello,

I'm trying to sync my windows phone FTP server to localdisk.
I'm using PowerShell (windows 10)
and WinSCP-5.9.1-Automation

The main part of my script:

$session.add_FileTransferred( { FileTransferred($_) } )

# Connect
$session.Open($sessionOptions)

$transferoptions = New-Object WinSCP.TransferOptions
# $transferOptions.FileMask = "*>2016-O8-01"
$transferoptions.FileMask = ".txt"


# Synchronize files
$synchronizationResult = $session.SynchronizeDirectories([WinSCP.SynchronizationMode]::Local, $FTPLocalFolder, $FTPRemoteFolder, $false, $transferoptions)

# Throw on any error
$synchronizationResult.Check()


At the end, I only want to sync files where dateModified > 2016-08-01. This filemask didn't work, so I tried with FileMask = ".txt", but this didn't work either: all files are synchronized, no matter what the extension is.

What do I wrong?

Kind regards,
Bart