Skip to content

Instantly share code, notes, and snippets.

@vivek1986
Created October 28, 2023 12:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vivek1986/f328102d993486695a05d9199195790a to your computer and use it in GitHub Desktop.
Save vivek1986/f328102d993486695a05d9199195790a to your computer and use it in GitHub Desktop.
PowerShell & Batch+PowerShell Hybrid Script to Rename almost any Video/Movie/Episode file you ever want
<# ::
@echo off
powershell -c "iex ((Get-Content '%~f0') -join [Environment]::Newline); iex 'main %*'"
goto :eof
#>
$validExtensions = '.mkv', '.mp4'
Get-ChildItem -File |
Where-Object Extension -In $validExtensions |
Where-Object Length -GT 500mb |
Rename-Item -NewName {
($_.BaseName -replace 'MkvHub.com - ' -replace '(?<=1080p|720p).+' -replace '\.', ' ').ToUpper() + $_.Extension
}
<# ::
@echo off
powershell -c "iex ((Get-Content '%~f0') -join [Environment]::Newline); iex 'main %*'"
goto :eof
#>
$validExtensions = '.mkv', '.mp4'
Get-ChildItem -File |
Where-Object Extension -In $validExtensions |
Where-Object Length -GT 500mb |
Rename-Item -NewName {
($_.BaseName -replace 'MkvHub.com - ' -replace '(?<=1080p|720p).+' -replace '\.', ' ').ToUpper() + $_.Extension
}
$validExtensions = '.mkv', '.mp4'
Get-ChildItem -File |
Where-Object Extension -In $validExtensions |
Where-Object Length -GT 500mb |
Rename-Item -NewName {
($_.BaseName -replace 'MkvHub.com - ' -replace '(?<=1080p|720p).+' -replace '\.', ' ').ToUpper() + $_.Extension
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment