Skip to main content
Plex automatically attempts to match your media with online databases and downloads associated Metadata (such as cover art and release date). In order to make this matching is successful and your media is correctly matched, it is important to name your files properly. This can be a tedious activity to do manually, especially for tv series where there can be more than 20 episodes per season. Luckily there is a tool you can use for this that helps make the process much faster. A program called Filebot can be used to automatically match and rename your media.

Getting Filebot
Filebot is available for a variety of platforms in both GUI and commandline forms. As this is a part of our Plex guide series, this will focus on the commandline version and usage. We will continue with the assumption of a headless Ubuntu 16.04 server. To download filebot onto your server, get the URL to the latest download from the Filebot webpage, then use wget to download it.

wget ""
Filebot uses sourceforge to host it’s packages so the download with wget may not be in .deb format. Simply rename the downloaded file to filebot.deb and then you can use dkpg to install it.

 mv download.php\?type\=deb\&arch\=amd64\&version\=4.7.9 filebot.deb
sudo dpkg -i filebot.deb
Filebot also requires Java and libmediainfo to run. You can install these through apt-get:
sudo apt-get install default-jre libmediainfo-dev
Once you’ve got this complete, Filebot will be installed on your Ubuntu server! You can check that it is working by checking the version like this:
filebot -version
filebot -version
FileBot 4.7.9 (r4984) / OpenJDK Runtime Environment 1.8.0_121 / Linux 4.4.0-70-generic (amd64)
Using filebot
Filebot has a help flag that shows the various options for using it on the commandline. Simply run this to see the options and a brief description of what each one does:
filebot -help
The most important flags in this list are -rename –action –db -non-strict and -r. These flags are the core ones to use when analyzing and renaming your media.
Setting this flag tells filebot to actually rename your files. Without this flag filebot will only analyze your media, not actually rename it.
With this flag you can tell filebot what to do with the new matches. You can have it create copies in a separate directory, create hard or soft links, or (and the one I will go over in an example) have it run a test without changing anything so you can verify the results before running it.
With this option, you set which database filebot should match against. The ones we will use are TheTVDB and TheMovieDB as those are the two that Plex uses.
By default, filebot uses strict matching. This means you need to have your files named fairly close to what they should be already, defeating most of the purpose of filebot. Using this flag turns that off and lets filebot be more generous with it’s matching. Use this when filebot is not finding your media with the default strict option.
Recursive. If you have media in multiple folders (such as multiple seasons of a show) you can use this option to make sure filebot looks inside each folder and attempts to match all of them.
Example run
To help pull all of this together, here is an example run for Rick and Morty, Seasons 1 and 2.
To start off, I am located in the directory with my TV Shows on my Plex Server. I then run this query to do a test run and see what the output would be:
filebot -rename --action test --db TheTVDB -r -non-strict Rick_and_Morty/
The output can be rather long as each episode shows the original and what it would be renamed to. I am only going to show 3 episodes as examples below:

Rename episodes using [TheTVDB]

Auto-detected query: [Rick and Morty]

Fetching episode data for [Rick and Morty]

[TEST] From [Rick_and_Morty/Season_1/Rick_and_Morty_Season_1_t00.mkv] to [Rick_and_Morty/Season_1/Rick and Morty – 3×01 – The Rickshank Rickdemption.mkv]

[TEST] From [Rick_and_Morty/Season_1/Rick_and_Morty_Season_1_t01.mkv] to [Rick_and_Morty/Season_1/Rick and Morty – 1×01 – Pilot.mkv]

[TEST] From [Rick_and_Morty/Season_1/Rick_and_Morty_Season_1_t02.mkv] to [Rick_and_Morty/Season_1/Rick and Morty – 1×02 – Lawnmower Dog.mkv]

As you can see, the matching is slightly off. Because when the media is ripped it started with the first episode as t00.mkv, this is incorrectly matched by filebot. To correct this, I need to rename my episodes so they start with t01.mkv instead. Here is a bash script you can use to automatically do this for all files in a specified directory. Note this does require files to be formatted as the script expects.

Once the files are renamed, I can run the filebot script again and the episodes are now showing as matched correctly. I can then run it one more time with the –action set to move and it will then rename the files to the ones Plex will use to match. Again, I’m only showing the first few lines even though it did rename both folders and all episodes:

filebot -rename --action move --db TheTVDB -r -non-strict Rick_and_Morty/

Rename episodes using [TheTVDB]

Auto-detected query: [Rick and Morty]

Fetching episode data for [Rick and Morty]

[MOVE] From [Rick_and_Morty/Season_1/Rick_and_Morty_Season_1_t1.mkv] to [Rick_and_Morty/Season_1/Rick and Morty – 1×01 – Pilot.mkv]

[MOVE] From [Rick_and_Morty/Season_1/Rick_and_Morty_Season_1_t10.mkv] to [Rick_and_Morty/Season_1/Rick and Morty – 1×10 – Close Rick-Counters of the Rick Kind.mkv]

[MOVE] From [Rick_and_Morty/Season_1/Rick_and_Morty_Season_1_t11.mkv] to [Rick_and_Morty/Season_1/Rick and Morty – 1×11 – Ricksy Business.mkv]


With this program it becomes much easier to make sure your media is named properly for easy Plex matching. You can also easily integrate this into scripts to automatically find matches and rename files. Many examples of this can be found on the filebot forums where various users have presented their solutions. Go there for more information or help crafting your own custom script for your setup.
The next guide in this series will cover media transcoding to make your media easier to store and stream!
Comments are disabled for this guide.