Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Get Episodes
- Get-ChildItem $showDirectory -Recurse -File | Where-Object { $_.Extension -in (".mp4", ".mkv", ".avi", ".m4v", ".mpg") } | ForEach-Object {
- $insertQuery = @"
- INSERT INTO Episodes VALUES ('$($_.Directory.Parent.Name -replace "'", "")',
- '$($_.Directory.Name)',
- '$($_.Name -replace "'", "")',
- '$($_.Length)',
- '$((ReadableFileSize $_.Length))',
- '$((VideoDurationSeconds $_.FullName))',
- '$((ReadableDuration $_.FullName))',
- '$((Get-VideoResolution $_.FullName))',
- '$($_.Extension)',
- '$($_.LastWriteTime)',
- '$($_.CreationTime)',
- GETDATE())
- "@
- Invoke-Sqlcmd -ConnectionString $connectionString -Query $insertQuery -ErrorAction Stop
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement