Skip to content

Instantly share code, notes, and snippets.

@mattiasghodsian
Created December 1, 2019 21:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattiasghodsian/a83cc7a06448f742cfedfb6dfaa0299b to your computer and use it in GitHub Desktop.
Save mattiasghodsian/a83cc7a06448f742cfedfb6dfaa0299b to your computer and use it in GitHub Desktop.
Renames TV files
Write-Host "################################ `n### TV File renamer by https://github.com/mattiasghodsian ### `n################################`n" -ForegroundColor Red
$series = Read-Host -Prompt 'Enter Series name (no end space)'
Write-Host "Set $series" -ForegroundColor Red -BackgroundColor Yellow
$season = Read-Host -Prompt 'Enter Season (example 01)'
Write-Host "Set $season" -ForegroundColor Red -BackgroundColor Yellow
Write-Host "Processing"
$path = Get-Location
$int = 1
Get-ChildItem -Path $path -Recurse -Exclude *.ps1,*.zip -Filter "*" -file | %{
$extension = $_.Extension
$newInt = "{0:D2}" -f $int
$curName = $_.Name
$newName = "$series S$season E$newInt$extension"
Rename-item -literalpath $_.PSPath -NewName $newName
Write-Host "$newName" -ForegroundColor Green
$int++
}
PAUSE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment