Thanks for sharing your solution.
- martin
try
{
$folderInfoSpec1 = Get-ChildItem -Path $localfolder -Filter *.mxf | Measure-Object -Property Length -Sum
$folderCountSpec1 = $folderInfoSpec1.Count
$folderSizeSpec1 = $folderInfoSpec1.Sum
###
$folderInfoSpec2 = Get-ChildItem -Path $localfolder -Filter *.xml | Measure-Object -Property Length -Sum
$folderCountSpec2 = $folderInfoSpec2.Count
$folderSizeSpec2 = $folderInfoSpec2.Sum
###
$folderInfoSpec3 = Get-ChildItem -Path $localfolder -Filter *.jpg | Measure-Object -Property Length -Sum
$folderCountSpec3 = $folderInfoSpec3.Count
$folderSizeSpec3 = $folderInfoSpec3.Sum
}
finally
{
$folderInfoSpec1Converted = $folderSizeSpec1 /= 1073741824
$folderInfoSpec1ConvertedR = [Math]::Round($folderInfoSpec1Converted,2)
#Write-Host "$folderCountSpec1 MXF Assets ($folderInfoSpec1ConvertedR GB) in total"
###
$folderInfoSpec2Converted = $folderSizeSpec2 /= 1073741824
$folderInfoSpec2ConvertedR = [Math]::Round($folderInfoSpec2Converted,2)
#Write-Host "$folderCountSpec2 XML Assets ($folderInfoSpec2ConvertedR GB) in total"
###
$folderInfoSpec3Converted = $folderSizeSpec3 /= 1073741824
$folderInfoSpec3ConvertedR = [Math]::Round($folderInfoSpec3Converted,2)
#Write-Host "$folderCountSpec3 JPG Assets ($folderInfoSpec3ConvertedR GB) in total"
### Combine all values
$folderCountSpecCombined = $folderCountSpec1 + $folderCountSpec2 + $folderCountSpec3
$folderInfoSpecCombined = $folderInfoSpec1ConvertedR + $folderInfoSpec2ConvertedR + $folderInfoSpec3ConvertedR
Write-Host "$folderCountSpecCombined Assets with accepted filetypes ($folderInfoSpecCombined GB) in total"
# Disconnect, clean up
$session.Dispose()
}
# 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()