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


ahh i knew i could rely on you! thank you very, very much!
Have a good day!

Summarize file length of to be transferred assets

Hi again,
I'd like to display the amount of -local- files to be synchronized including the total file length/size of them.
on the remote side (amount of obsolete assets to be deleted including total space which is getting free'd) this works like a charm with "$fileInfo.Length" so far.

Heres my current approach, it already displays the amount of files (which fit my filemask) correctly, but not any filesize, maybe you'd be so kind and help me out on this?
Cheers, have a nice day!
$localdiffs = $session.CompareDirectories([WinSCP.SynchronizationMode]::Remote, $localPath, $remotePath, $True ,$True, [WinSCP.SynchronizationCriteria]::Size, $transferOptions)
$DifferentLocalAssets = 0
$DifferentLocalAssetSize = 0
foreach ($diff in $localdiffs)
if (($diff.Action -eq [WinSCP.SynchronizationAction]::UploadNew) -or
($diff.Action -eq [WinSCP.SynchronizationAction]::UploadUpdate))
$DifferentLocalAssetSize = $DifferentLocalAssetSize + $fileInfo.Length
Write-Host "$DifferentLocalAssets Assets ($DifferentLocalAssetSize *UNIT*) will be uploaded next sync"
# Disconnect, clean up