Reputation: 11
I extract videoclip duration from a .mp4 file as a string in "hh:mm:ss" format:
$duration = $shellfolder.GetDetailsOf($shellfile, 27)
I want to get the total duration of all videoclips in a folder. How can I sum up these durations without extracting the seconds, minutes each time ?
Upvotes: 0
Views: 104
Reputation: 47792
Cast the duration as a [TimeSpan]
and then add it with the others:
$totalDuration = New-TimeSpan
# making up a loop since you didn't provide one
foreach ($shellfile in $Files) {
$duration = $shellfolder.GetDetailsOf($shellfile, 27)
$totalDuration += ([TimeSpan]$duration)
}
Upvotes: 1