Summarize file length of to be transferred assets

Advertisement

Ch33s3
Donor
Joined:
Posts:
10
Location:
World

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))
{
$DifferentLocalAssets++
$DifferentLocalAssetSize = $DifferentLocalAssetSize + $fileInfo.Length
}
}
finally
{
Write-Host "$DifferentLocalAssets Assets ($DifferentLocalAssetSize *UNIT*) will be uploaded next sync"
# Disconnect, clean up
$session.Dispose()
}
...

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum