Best Folder Structure For Fastest Library Scan?

Hi,

When scanning a library does plex look at each individual folder to see if the size has changed and if not, movies to check next folder?

If you have 20,000 video files, which scenario would be fastest?

a. Put all 20,000 video files in one folder. In my mind, if I do that, then Plex will have to scan each of the 20,000 video files until it finds the newly added file.

b. Create 4 folders such as 1-4999, 5000-9999, 10000-14999, 15000-20000. And then split the 20,000 files into 5000 file lots and add them to each of the 4 folders?

The latter sounds like the more logical way if Plex does indeed keep a record of folder sizes. Then all it would have to do is to search within the folder with the conflicting file size.

Anyone know which is faster?

Thanks!

Some clarification,

The way my NAS is set up, I had to turn off the autoscan library feature.

Just give every movie it’s own main folder within your movie folder. No need for additional aggregation.
If your system supports system level events about file system changes you can configure Plex to automatically update based on such events and only update that part of your library.

Scenario (a) will indeed require more performance/time to scan every single file. Scenario (b) will not necessarily give you any benefits (certainly not if you want to place 5000 files flat into each of them.

In addition, from what I remember if a file is changed/added within a folder plex will rescan all files within that folder. So if you have a flat structure with 5000 files and add one then all will be scanned.

This is why folders are best for movies and shows/seasons.

1 Like

Hi and thanks for your input!

Wouldn’t that be the same as just dumping all 20,000 files into one folder? Won’t plex STILL have to go through and check each folder to see if the size has changed?

If you check the server/scanner logs you should see that Plex goes for a variety of parameters to identify changes. This is if you trigger a full scan.
With automatic updates you can get Plex to do a partial scan which will only focus on what has actually changed.
For a full scan (manually triggered or periodic), Plex will anyway go through all folders. However with each movie (and all its local assets / extras) in its own folder, Plex can e.g. check when the folder was last touched and only dig into those to do a more detailed analysis (e.g. to check the size or fingerprint of your file).

With a flat structure (all files in a single folder or split in 4 folders, it’ll still need to touch every single file to identify which ones have changed (“immediate full scan” vs. “simple check” + “full scan only if necessary”).

From https://support.plex.tv/articles/naming-and-organizing-your-movie-media-files/

Movies in Their Own Folders

Movie files can be placed into individual folders and this is recommended, as it can (sometimes significantly) increase the speed of scanning in new media. If you have external media for a movie (e.g. custom poster, external subtitle filess, etc.) you should usually place the movie in a nested folder along with the custom media files. Name the folder the same as the movie file:

1 Like

Ok, I believe I understand your explanation. So now I am interested in placing all the video files into their own folders. Is there an easy way to do this automatically? I’d hate to have to manually create 20,000 + folders…would take forever :slight_smile:

Hi, thanks for your input. I am going to start placing all video files into their own folders. Now if I can only find a way to do it automatically :slight_smile: instead of having to manually create 20,000 + folders lol.

I think I found a batch file to do this…I will post my progress and solution.

You could check out FileBot – it can rename files but also organize them in a defined folder structure.

Oh for real? I just bought that yesterday :slight_smile: HAHA!

Could you please point me to the help file that shows how to do that with Filebot? I am on the websites FAQ’s but haven’t found anything.

Never used it myself. From what I’ve been reading Filebot has a number of presets for naming schemas – or you set your own schema
https://www.filebot.net/forums/viewtopic.php?t=7

This command line will put every movie file in a folder - on the root (where I use it for files before adding them):

{n} ({y}) [{vf} {vc}]/{n} ({y}) [{vf} {vc}]{subt}

image

King of New York (1990) [1080p x265]\
...King of New York (1990) [1080p x265].mkv
...King of New York (1990) [1080p x265].eng.mkv
...(including a sidecar sub file - if present)

Filebot’s site has more info.

I put 6000+ movies in a unique folder - in a week or so.
It would have taken a few months by hand

2 Likes

Yeah seems that there’s a permission issue with my Synology. I opened a ticket with Synology to see if there is an easy fix.

hmmm, I have tried your code and nothing happened. However, if I try it on my local C drive, it works fine. I have a
DS418play that I use for all my files. Seems that maybe there is some sort of permission issue.

You said

This command line will put every movie file in a folder - on the root (where I use it for files before adding them):

Is that why you said “on the root”?

So I ended up having to run the batch file. I have got to say…it would typically take about 8 hours to recreate the entire library which I have had to do a couple of times.

Now that all the video files are in there own folder…the process is taking 1000 times longer (no exaggeration)…if not more. Is it supposed to be taking this long doing it this way? ■■■■ that…

For example, I started the library scan at 7:28 pm and an hour later only 4 videos have finished processing. When I had all the videos in one folder there would have been a few thousand finished processing by now easy.

Thoughts?

I put 6000+ movies in a unique folder - in a week or so.
It would have taken a few months by hand

Here’s a faster way… took less than 5 minutes for 4,500 movies. Script is below the video.

@echo off
for %%i in (*) do (
if not “%%~ni” == “organize” (
md “%%~ni” && move “%%~i” “%%~ni”
)
)

I’ve been meaning to ask you - why don’t you use the {plex} naming/binding/scheme in FileBot?

'Cause it crams everything into folders called TV Shows, or Movies on my D: Drive (the initial landing pad) - immediately - way before I’m done with them. <— and I have hundreds of Library Folders scattered across 6 HDDs so I can balance the storage load - few of which are called TV Shows or Movies. <— I haven’t found a way for FB to do that… yet. For now that takes a human interface device - me.

Your script doesn’t go to a database and correct any mismatching and misnaming while you are doing what you hope isn’t a waste of time - for what could be - the last time.

I’m fairly confident when FB and I get done - we’re done.

When my movies weren’t in folders a “Movie Library Scan” took about an hour.
With all my movies in folders a “Movie Library Scan” takes about 45 seconds.

That’s all I need to know.

Yeah you are missing my point because there wasn’t enough information. I had already used Filebot to properly name all of my video files. That was step one. Step two was me asking the best way to structure the folders for fastest library scan.

My solution to batch creating folders with file names and then moving those files into the proper folders was task specific for what I needed because of what steps I had previously taken or overlooked.

I agree though… Filebot is pretty bad ass and def worth the $6 if you have a large library that you want to pretty up.

That’s good to know about the speed you are now getting when you library scan. I am doing the plex dance as we speak :slight_smile: