I am trying to measure the recursive size of a ccmcache directory that is currently being downloaded with BITS.
I am using the following Powershell script to measure the recursive size of the directory.
(Get-ChildItem $downloadPath -recurse | Measure-Object -property Length -sum).Sum
This script works for "normal" directories and files, but it fails with the following error if the directory only contains .tmp
files.
Measure-Object : The property "Length" cannot be found in the input for any objects.
At line:1 char:27
+ (Get-ChildItem -Recurse | Measure-Object -Property Length -Sum).Sum
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Measure-Object], PSArgumentException
+ FullyQualifiedErrorId : GenericMeasurePropertyNotFound,Microsoft.PowerShell.Commands.MeasureObjectCommand
How can I measure the recursive size of a directory that only contains .tmp
files created by the BITS downloader.