[Plain File Mode] Rename subtitle files to match the name of a nearby video file

All about user-defined episode / movie format expressions
Post Reply
User avatar
rednoah
The Source
Posts: 21345
Joined: 16 Nov 2011, 08:59

[Plain File Mode] Rename subtitle files to match the name of a nearby video file

Post by rednoah »

Option A: Use the {folder} binding to find nearby files


Use Case: Use a Plain File Mode custom Preset to rename the given files so that the each file is assigned the same file name as the largest file in the same folder.

Code: Select all

{ folder.files.max{ it.length() }.nameWithoutExtension }{ subt }
Image

Image






Option B: Use the {mediaFile} binding to find the primary media file


:idea: The {mediaFile} binding can also be used to find the primary video file for a given subtitle file, from the same folder or parent folder, which can then be used to rewrite the subtitle file path:

Code: Select all

{ mediaFile.dir }/{ mediaFile.nameWithoutExtension }{ subt }

:!: {mediaFile.dir} is the parent folder of the primary video file, and so the subtitle file will be moved there. {mediaFile.nameWithoutExtension} will ensure that the subtitle file will be named after the primary video file, so that the names match exactly. If subtitles were originally organized into Subs or Subtitles sub-folders then FileBot will delete these sub-folders automatically if left behind empty.
:idea: Please read the FAQ and How to Request Help.
Post Reply