Skip to content

Instantly share code, notes, and snippets.

@jordanfarrer
Created October 16, 2015 15:31
Show Gist options
  • Save jordanfarrer/54b377826bb0e3770ae8 to your computer and use it in GitHub Desktop.
Save jordanfarrer/54b377826bb0e3770ae8 to your computer and use it in GitHub Desktop.
Calculates total duration of movies within a directory
$totalSeconds = 0
$wmp = New-Object -ComObject wmplayer.ocx
ls {{movieDirectoryPathHere}} -Recurse -Filter *.m4v | %{
$movie = $wmp.newMedia($_.FullName)
$totalSeconds += $movie.duration
}
Write-Host "$totalSeconds seconds."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment