Post a reply

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


PowerShell $transferOptions.FileMask not working


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

$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

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,