Created
October 28, 2023 12:39
-
-
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
This file contains 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
<# :: | |
@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 | |
} |
This file contains 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
<# :: | |
@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 | |
} |
This file contains 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
$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