Created
October 16, 2015 15:31
-
-
Save jordanfarrer/54b377826bb0e3770ae8 to your computer and use it in GitHub Desktop.
Calculates total duration of movies within a directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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