Enumerate local assets matching $transferoptions.filemask
Hi again,
I'd like to count all local assets matching my filemask, regardless of its state (already synced or not should not matter in this case)... is there a way to archive this with WinSCP ?
heres my approach, would you be so kind an help me out again on this one ?
Have a nice day and thanks for your help !
I'd like to count all local assets matching my filemask, regardless of its state (already synced or not should not matter in this case)... is there a way to archive this with WinSCP ?
heres my approach, would you be so kind an help me out again on this one ?
# Connect $session.Open($sessionOptions) ######FILEMASK-SETTING####### $transferoptions = New-Object WinSCP.TransferOptions $transferoptions.filemask=$acceptedExtensions ############################### $LocalAcceptedAssets = $session.SynchronizeDirectories([WinSCP.SynchronizationMode]::Remote, $localPath, $remotePath, $True ,$True, [WinSCP.SynchronizationCriteria]::Size, $transferOptions) $LocalAssetCount = 0 $LocalAssetCountSize = 0 foreach ($asset in $LocalAcceptedAssets) { if (($asset.Action -eq [WinSCP.SynchronizationAction]::null) -or ($asset.Action -ne [WinSCP.SynchronizationAction]::null)) { $LocalAssetCount++ $LocalAssetCountSize += $asset.Local.Length } } Write-Host "$LocalAssetCount Assets ($LocalAssetSizeCountGBConvertedR GB) in total" # Disconnect, clean up $session.Dispose()