Duplicate Movie Removal Automation?

I have been looking for a solution to this for months.

Basically what I am looking for is a way to automate the process of deleting older versions of movies. Let me explain.

In plex, when I download a newer copy of a movie it shows up as a duplicate. That makes sense, if I go to the folders I do indeed have two copies of the movie. I can manually delete the older movies one at a time after hunting them down, but with 6k plus movies that’s going to take way more time and labor than I’m willing to put in.

I tried Filebots “filebot -script fn:duplicates /path/to/files” but it only lists a tiny fraction of the actual duplicates, and it’s options do not allow for “delete oldest copy” … only “Delete lower quality”… which is not what I’m looking for.

For example I have two copies of the cartoon Aladdin. Both are the same resolution but one is has a slightly lower bitrate - in this case the newer copy. The reason I want to keep the one with the lower bitrate is because the filesize is less than half of the other, with no perceptible difference.

Can anyone point me in the right direction for finding duplicates and deleting the older one? (Last modified date).

Thanks!

Server Version#: 1.19.5.3112
Player Version#: 1.16.0.1364

I can’t believe these words are coming out my mouth to my finger tips but you could use Plex to delete the dups.
Here’s a way to find duplicates

To delete an item

While this isn’t an automatic process I suspect it’s very doable if you had one centralized location to find all duplicates and delete.

I appreciate the input and I was aware of this feature, but unfortunately this wont work. Here’s why.

  1. It’s not automated, and I have thousands of duplicates which is why I first mentioned a need for automation and then mentioned that I could already delete them manually but there are far too many.

  2. It does not allow me to select the “newest” version. The “delete” option simple pops up a little box and asks which one to delete, with no extra information. Both movies labeled the same, no date.

If plex had a feature that would allow for a scan/ delete of older duplicates that would be amazing, or I’m willing to use a third party solution like I mentioned with my attempts in filebot.

Thanks again

Why do you download movies you already have? Just curious?

I’m a bit confused…
How are you adding movies to Plex, manually or some automatic process(Radarr comes to mind).
Are they all in one centralized location, one/two big a$%& drives or scattered all over many drives?)?
If you are adding the movie then can’t you delete the old one at the same time?

Smaller filesize, better compression, different resolution etc.

I do that too but I don’t put them in the library without comparing the new version to the old and 1) tossing the new if it isn’t better or 2) tossing the old if it is. I can’t see just dumping in random movie downloads on the hope that they are better.

@NewPlaza
A bit of manual, a bit of automation.
When the movie is done downloading (batch of 100+), I run them through filebot for automated tagging and removing extra files that might have come with it. Then I copy/ paste the whole lot into the movies directory on my server.
I don’t want to go through 100+ individual folders every time and compare the “last modified by” date on each one, then deleting.

Easy peazy when the one it replaces has an identical name, and identical container - teracopy just overwrites the old one.

More often than not however, I’m replacing an MKV with an H.265 MP4, so I’m left with two copies of the same movie in the same directory.

@tramp78
I don’t just hope is one is better than the other, I deliberately seek out copies that meet specific criteria to replace old ones that have been sitting in the library for years and now there’s better copies of. If it were just a couple of movies at a time (like it was years ago) then yes I would manually delete the old ones, no big deal. I however do not have time to manually do that with hundreds of them at a time, and as it builds up thousands.

Ultimately I might have to pay someone on fiverr to throw some automation script together for me but I was hoping that someone in this forum or the filebot forum (which I’m also seeking advice in) could point me to an already existing solution.

Thanks again for everyone input.

Are there just the movies in each folder or are there more files such as trailers, extras, etc…
I’m sure a windows batch file could be created IF the only thing in each individual movie folder was the new movie and the old movie.

Open the Duplicates screen, and click the “More” dots in the lower right of the movie poster.

image

Select “Get Info” (the last choice in the list).

This won’t tell you the date, but it will tell you something better; which file is higher quality. You can scroll down to see the attributes for both movies. Scroll back to the top, the top movie is the first one listed below, the bottom movie is the second one in the attributes list. Off the to right you see delete file links… choose carefully.

Thank you for the suggestion but as previously stated this would be too time consuming. I am really looking for automation for the thousands of movies that this will need to be done to on a regular basis going forward.

There are also subtitle files :confused:

This is a far cry from the idea you’re looking for BUT, it can be done… assuming a few things.

  • Only the old movie and old subtitle exist in folder.
  • You’re also replacing the subtitle file as well.
  • NO other file exists but the old movie and the old subtitle file.

Why don’t you delete the existing “old” folder before you copy over the new movies. I’m assuming the new movies are already in their respective folder. Delete the old folder, copy/move over the new folder.

Do you know if there are any tools that might accomplish this for me? I think this would work but would need to be automated and I have no talent for scripting whatsoever hahaha

Unfortunately not. A script would be fairly easy to create assuming the old path and new paths are known.

Here’s a small skeleton script that could get you started.

@ECHO OFF
FOR /F "tokens=*" %%G IN ('DIR /B /A:D') DO (
	ECHO Folder found: [ %%G ]
	ECHO Old Folder Path: [ D:\MyOldPath\%%G ]
REM * RMDIR /Q /S D:\MyOldPath\%%G
REM * https://www.windows-commandline.com/delete-directory-from-command-line/
	ECHO.
	ECHO.
)
PAUSE

Basically, it reads the current folder(where the batch file resides) for all folders, then prepends the old path to it.

the short answer is there is no automated way to do this via plex.

as already alluded to above, if you are using other tools to acquire/upgrade videos, then you should more closely investigate features already in those tools to delete the older video.

1 Like

Thanks, I’ll see what I can figure out

@TeknoJunky, I already am. Exploring all options.

Automation got you where you are.

Any Questions?

No, but thanks. As previously stated, a combination of factors got me where I am. It’s not the end of the world, and I’ll probably just pay someone on fiverr to write me a script to sort it out like I’ve had to do with other projects but was hoping someone else might have already run into this issue and that there might be a chance of an already existing solution.
Thanks anyway.

I would first look at TeraCopy documentation to see if it has some type of sync copy. Meaning, it will mirror the contents of the old folder to the new.

1 Like