-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathHevc_Tool.ps1
42 lines (40 loc) · 1.3 KB
/
Hevc_Tool.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
$Directory = "Z:\media"
Write-Host "Working in $Directory"
$Method = "Exclude"#Rename,Exclude,Verify
$Exclud = "C:\temp\Exclude.txt"
$Filename = "C:\temp\Filename.txt"
$FileList = Get-Content -Path "$Exclud"
if ($null -eq $Method) {
Write-Host "Please Specify Method"
Break
}
#Gets The Videos To Convert
$Videos = Get-ChildItem $Directory -Recurse -Exclude "*_MERGED*" | Where-Object { $_ -notin $FileList -and $_.extension -in ".mp4", ".mkv", ".avi", ".m4v", ".wmv"} | ForEach-Object { $_.FullName } | Sort-Object
$Count = $Videos.count
Write-Host "$Count Files to be $Method."
#Video Batch
Foreach ($Video in $Videos) {
if ($Method -eq "Exclude") {
Add-Content $Exclud "$Video"
}
if ($Method -eq "Rename") {
if ("$Video" -match ',') {
$Vidz = $Video -replace ',', ''
Rename-Item -Path $Video -NewName $Vidz
}
if ("$Video" -match ';') {
$Vidz = $Video -replace ';', ''
Rename-Item -Path $Video -NewName $Vidz
}
}
if ($Method -eq "Verify") {
if ("$Video" -match ',') {
$Vidz = $Video -replace ',', ''
Add-Content $Filename "$Video"
}
if ("$Video" -match ';') {
$Vidz = $Video -replace ';', ''
Add-Content $Filename "$Video"
}
}
}