Created
May 1, 2023 16:06
-
-
Save hansgafriedzal/86e9f5020ff0b51a15b09667fcc45b2d to your computer and use it in GitHub Desktop.
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
dir $PSScriptRoot\*\Subs | foreach { | |
$_.Parent.FullName | |
$movieDir = $_.Parent.FullName | |
cd $movieDir | |
$movieFileName = dir *.mkv, *.mp4, *.avi | select -ExpandProperty BaseName -First 1 | |
cd $_ | |
dir *.srt | where BaseName -like *english* | sort Length -Descending | select -First 1 | foreach { | |
$newSub = $movieFileName + '.en' + $_.Extension | |
if (Test-Path ($movieDir + '\' + $newSub)) {} else { | |
copy $_ $movieDir | |
ren ($movieDir + '\' + $_.Name) $newSub | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment