Skip to main content

Rename Episode

Rename Episode

Renames and moves a TV episode into a standard show and season folder structure, using a naming pattern.

Input:  TV/The ShowName/The ShowName - 1x01.mkv
Output: TV/ShowName, The (1999)/Season 01/ShowName, The (1999) - s01e01 - Pilot.mkv
tip

Run a TV Episode Lookup before this flow element for the best results. Without it, the episode is read from the file name and its folders, which often has no episode title and no year for the show.

Where the episode's details come from​

  1. TV Episode Lookup variables. If a TV Episode Lookup earlier in the flow found the episode, its show, year, season, episode, title and IDs are used.
  2. The file name and folders. Otherwise, as much as possible is read from the file's path.
PathShowYearSeasonEpisodeTitle
The ShowName/The ShowName - 1x01.mkvThe ShowName11
The ShowName/The ShowName - S1E1.mkvThe ShowName11
The ShowName/The ShowName - 101.mkvThe ShowName11
The ShowName/The ShowName - S01E01-E02.mkvThe ShowName11-2
The Show (2005)/Season 2/the.show.s02e03.mkvThe Show200523
Some Show/Season 2/Episode 5.mkvSome Show25
Some Show/Specials/Some Show - E03.mkvSome Show03
Alien.Earth.S01E06.The.Fly.1080p.WEB-DL.mkvAlien Earth16The Fly
The Walking Dead (2010) [tvdbid-153021]/Season 07/S07E03 - The Cell.mkvThe Walking Dead201073The Cell

Release details such as 720p, 1080p or x264 are never mistaken for an episode number. A show's folder written as Simpsons, The is read as The Simpsons, so renaming an already renamed file gives the same name.

If the season and episode cannot be found, the file is not changed and output 2 is called.


New Name​

The episode's new name: its folders and file name, relative to the Destination Folder. Pick one of the common naming formats, or Custom to write your own. What the picked one gives is shown under it:

NameNew NameExample
Show, The (Year) / Season 01 / Show, The (Year) - s01e01 - Title{Show|the} ({Year})/Season {Season|00}/{Show|the} ({Year}) - s{Season|00}e{Episode|00} - {Title}{ext}Simpsons, The (1989)/Season 01/Simpsons, The (1989) - s01e01 - Simpsons Roasting on an Open Fire.mkv
Show (Year) / Season 01 / Show (Year) - S01E01 - Title{Show} ({Year})/Season {Season|00}/{Show} ({Year}) - S{Season|00}E{Episode|00} - {Title}{ext}The Simpsons (1989)/Season 01/The Simpsons (1989) - S01E01 - Simpsons Roasting on an Open Fire.mkv
Show / Season 01 / Show - S01E01 - Title{Show}/Season {Season|00}/{Show} - S{Season|00}E{Episode|00} - {Title}{ext}The Simpsons/Season 01/The Simpsons - S01E01 - Simpsons Roasting on an Open Fire.mkv
Show (Year) / Season 01 / S01E01 - Title{Show} ({Year})/Season {Season|00}/S{Season|00}E{Episode|00} - {Title}{ext}The Simpsons (1989)/Season 01/S01E01 - Simpsons Roasting on an Open Fire.mkv
Show.Year.S01E01.Title{Show|dots}.{Year}.S{Season|00}E{Episode|00}.{Title|dots}{ext}The.Simpsons.1989.S01E01.Simpsons.Roasting.on.an.Open.Fire.mkv
Show (Year) [tvdbid-ID] / Season 01 / Show (Year) - S01E01 - Title{Show} ({Year}) [tvdbid-{TvdbId}]/Season {Season|00}/{Show} ({Year}) - S{Season|00}E{Episode|00} - {Title}{ext}The Simpsons (1989) [tvdbid-71663]/Season 01/The Simpsons (1989) - S01E01 - Simpsons Roasting on an Open Fire.mkv

The default is the first, Show, The (Year) / Season 01 / Show, The (Year) - s01e01 - Title. If the new name is ever empty, the default is used. Folders can be separated by / or \, on any operating system.

Writing a custom new name​

A custom new name can use these, with + Variable to insert one and its formatter:

VariableDescriptionExample
{Show}The showThe Simpsons
{Show|the}The show, with a leading "The" moved to the end for sortingSimpsons, The
{Show|dots}The show, with dots in place of spacesThe.Simpsons
{Year}The year the show first aired1989
{Season|00}The season, zero padded01
{Episode|00}The episode, zero padded01
{LastEpisode|00}The last episode of a multi-episode file02
{Title}The episode's titleSimpsons Roasting on an Open Fire
{TvdbId}The show's TheTVDB ID71663
{TmdbId}The show's TheMovieDB ID456
{ext}The file's extension.mkv

Any other variable of the flow can be used too.

note

Number formats use a |, for example {Season|00}. {Season:00} is not a format and is left in the name as it is.

What is not known is left out​

Anything the new name uses that is not known is removed along with what surrounds it, so there are no empty brackets or dangling separators.

MissingWithout it
The episode's titleThe Simpsons (1989) - S01E01.mkv, not The Simpsons (1989) - S01E01 - .mkv
The show's yearThe Simpsons/Season 01/..., not The Simpsons ()/Season 01/...
The TVDB IDThe Simpsons (1989)/Season 01/..., not The Simpsons (1989) [tvdbid-]/...
The year and title, dottedThe.Simpsons.S01E01.mkv

Multi-episode files​

A file holding more than one episode names all of them: S01E01-E02. This happens wherever {Episode} is used, unless the new name uses {LastEpisode} itself.

Invalid characters​

Characters that are invalid in file names on any operating system are replaced or removed, whichever system FileFlows runs on, so libraries shared with Windows stay valid.

ValueIn the name
Star Trek: DiscoveryStar Trek - Discovery
AC/DCAC-DC
"Quoted"'Quoted'
What If?, <, >, *, |removed

A name never ends in a dot or a space.

The file extension​

The working file's extension is always kept, even if the new name does not end with {ext}.


Destination Folder​

The folder the new name is relative to, for example the TV library's folder.

If empty, the folder holding the show's folder is used. A file is put into a proper season folder even when it was directly in the show's folder:

FileDestination FolderWith the default new name
/tv/The Show/The Show - 1x01.mkv/tv/tv/Show, The/Season 01/Show, The - s01e01.mkv
/tv/The Show/Season 1/The Show - 1x01.mkv/tv/tv/Show, The/Season 01/Show, The - s01e01.mkv
/tv/The Show - 1x01.mkv (in the library's folder)/tv/tv/Show, The/Season 01/Show, The - s01e01.mkv

When the working file is a temporary file, for example after a conversion, the original file's location is used.

Season Folder Name​

The name of a season folder for libraries in another language. For example, Staffel gives Staffel 01.

If empty, Season is used, as the placeholder shows. A folder named with it is also understood as a season folder when files are read or renamed again.

Specials Folder​

If season 0 episodes go in a specials folder instead of Season 00. On by default.

Specials Folder Name​

Shown when Specials Folder is on. The name of the specials folder for libraries in another language.

If empty, Specials is used, as the placeholder shows; it's the name media servers expect.


Variables​

The episode's details are set as variables for the flow elements after this one, if the flow does not have them already:

VariableDescriptionTypeExample
tvepisode.TitleThe showstringThe Simpsons
tvepisode.SubtitleThe episode's titlestringSimpsons Roasting on an Open Fire
tvepisode.ShowYearThe year the show first airednumber1989
tvepisode.SeasonThe seasonnumber1
tvepisode.EpisodeThe episodenumber1
tvepisode.LastEpisodeOptional. The last episode of a multi-episode filenumber2
tvepisode.TmdbIdThe show's TheMovieDB IDnumber456
tvepisode.TvdbIdThe show's TheTVDB IDnumber71663

Outputs​

  1. Episode renamed
  2. Could not determine the show, season or episode