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

pfftanyname

filemask with regular expression

Greetings,
I modified the powershell script a bit. However I'd like to tweak it a bit more to on synchronize files with 7 digits + jpg extension. Is that possible? How do I do it with what I have so far?

$session = New-Object WinSCP.Session
$session.Open($sessionOptions)
$transferoptions = New-Object WinSCP.TransferOptions
$transferoptions.filemask="*.jpg"

$synchronizationResult = $session.SynchronizeDirectories([winscp.synchronizationmode]::Remote, $LocalPath,$RemotePath,$False,$true,[WinSCP.SynchronizationCriteria]::Size,$transferoptions)

$SynchronizationResult.check()
pfftanyname

Re: powershell filemask to include

martin wrote:



Thank you for your response. I modified the script and this works:

$transferoptions = New-Object WinSCP.TransferOptions
$transferoptions.TransferMode = [winscp.synchronizationmode]::Remote
$transferoptions.filemask="*.jpg"
$synchronizationResult=session.PutFiles($LocalPath,$RemotePath,$False,$transferoptions)
pfftanyname

powershell filemask to include

Hi I'm trying, by I'm really uncertain of the syntax in powershell with WinSCP. I'm trying to use filemask to include only *.jpg filetypes with performing a synchronize remote. So option to be used -filemask = "*.jpg". Without the filemask, I and synchronize:remote so it is working. Help with the syntax?

$transferoptions.filemask="*.jpg"

$synchronizationResult = $session.SynchronizeDirectories(
[WinSCP.SynchronizationMode]::Remote, "localdirectorypath", "/destpath/", $False, $transferoptions)