I have some video files that I need to rename. the name is something like this: [video name] [number].[file-extension] I have recently switched my media play software that requires a special naming order. The Order is as follows: [video name] e(increment start at 01)].[file-extension] additionally, the media player requires the folder structure like this: C:\Media\[series]\[season(increment start at 01)] I can do the folder structure manually, and renaming the files manually would be a possibility too, but I'd like to automate the process to save some time.
The best way to create the filename would be like this: check path to file like this:
$path = Get-Location
get-childitem "$path" -recurse | where {$_.extension -eq ".mkv"}
and detect the path before \season[number]. Ideally, the script would then remane the file like this: [video name = path(before season)] and then add e(increment start at 01)] based on a script like this:
$i = 1 Get-ChildItem *.mkv| %{Rename-Item $_ -NewName ('$_.Fullname{0:D4}.mkv' -f $i++)}
as seen here:
Bulk renaming of files with powershell however the media player will get confused if the series has 12 episodes and the filename is like this: s01e001
If it is not possible to do the part of getting the name based on the path, I'd like to have a script that renames the file to [series name] e[increment start from 01].mkv
Are there any ways to create a script to rename the files?
[video name]
contains and how to parse[series name]
from that. – Theo