-
Notifications
You must be signed in to change notification settings - Fork 61
/
Get-VideoFile.ps1
47 lines (42 loc) · 1.31 KB
/
Get-VideoFile.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
function Get-VideoFile {
[CmdletBinding()]
param (
[Parameter(Position = 0)]
[string]$Path,
[Parameter()]
[switch]$Recurse,
[Parameter()]
[int]$MinimumFileSize,
[Parameter()]
[array]$ExcludedStrings,
[Parameter()]
[array]$IncludedExtensions,
[Parameter()]
[string]$RegexEnabled,
[Parameter()]
[string]$RegexString
)
begin {
Write-JLog -Level Debug -Message "Function started"
}
process {
if ($ExcludedStrings) {
$files = Get-ChildItem -LiteralPath $Path -Recurse:$Recurse -Exclude:$ExcludedStrings | Where-Object {
$_.Extension -in $IncludedExtensions `
-and $_.Length -ge ($FileSize * 1MB)
}
} else {
$files = Get-ChildItem -LiteralPath $Path -Recurse:$Recurse | Where-Object {
$_.Extension -in $IncludedExtensions `
-and $_.Length -ge ($FileSize * 1MB)
}
}
if ($RegexEnabled -eq 'true') {
$files = $files | Where-Object { $_.BaseName -match $RegexString }
}
Write-Output $files
}
end {
Write-JLog -Level Debug -Message "Function ended"
}
}