I haven’t updated that tool in years, just didn’t have the time. I don’t know if it still works, but it can be found at MovieFan's Database Tool for Plex
After reading this thread, which started in 2015 and this thread, which is also running from 2015, I can’t seem to notice that those are 5 years of discusson about a feature, which can be implemented by a Plex Team in a week or so.
This is truly embarrassing, seeing that this feature is searched for and requested for 5 years in a row and the only solutions available are dangerous DB editing or weird instructions on how to move files between folders, while it is simply a matter of ONE additional menu option: Move media to another Library…
There is already an official way to do this, https://support.plex.tv/articles/201154537-move-media-content-to-a-new-location/. This DB modification is a quicker hack.
To be fair @anon18523487 , your SQL solution was the best one, even though it no longer works.
Just changing a path in a file is way easier than having to copy large batches of files which is not just time consuming, but requires a large amount of disk space to pull off in case of a large library. Mine is over 10TB, so it’s definitely gonna take a while to get this going.
An official way that doesn’t work. I’m just trying to move movies from one library to another. Followed the steps exactly - but no joy. Had to renter all metadata.
I agree with Velsa, this is really embarrassing after so many years and so much anguish!
Surprisingly, this was never entered as a “Feature Request”, so I added it. If you read this far in this long thread, then please find and vote for it.
Hi, I just want to drop big THANK YOU for these instructions.
I tried moving my photo library with ton of tags to unRaid, and was going desperate that it was impossible to retain them…
and then I stumbled on this thread and it worked.
Now that you showed me da way (the db), I’m thinking on developing tools for managing library files based on db - to be able to share photos with relatives and friends based on tags, without sharing whole library.
so thank you!
Can I use SQL to bulk add folders to a library?
I know this is an old post but I have a little update.
My situation was that I upgraded my HDD in my QNAP NAS and had to reset to default because I was unable to extend my HDD (legacy problem).
I installed the package to create a Plex share on my QNAP where I backed up all the data. I then factory default and reinstall everything on my QNAP to realize that the Multimedia path had slightly changed (from /share/MD0_DATA/Multimedia to /share/CE_CACHEDEV1_DATA/Multimedia/) which obviously caused me issues.
I tried the Plex Method but lost all the metadata I manually fixed/added. I then used the database hack but found out that 2 of the tables did not contain path anymore (metadata_items & media_streams).
I modified the 2 tables section_locations and media_parts so far everything seemed to have worked. My manual fixed/entries are still there. I have not tested extensively but will report back if I find issues.
Thanks!
Man, I just upgraded to a new hard drive, replacing four smaller hard drives. Get everything copied over, scanned libraries. When it’s done, I find 1,074 unmatched files. Good God.
I’ve never done any SQL or database modification or even knew what SQL was until today, so I’m tentative as hell to do that, but 1,074 files! That’s not to mention the files that matched to the wrong movies.
Is this something that a completely ignorant person would be able to accomplish by following the above steps? Does it make a difference if you’re on a Mac?
Or does the risk of effing things up outweigh the hours or days wasted it would take to re-match everything?
Maybe I’m oversimplifying it, but I would think if you have a library find two files that are identical, why wouldn’t it just match it to the same thing?
Copying (Ultimately Moving) media really only works if you’re using compliant file names and your media has been successfully, and naturally matched the first time.
If you’re Fixing Match, or madly editing items that won’t match on most of your items - expecting this to work is… folly.
You add a file Plex couldn’t match the first time and expect it to do better the second time - may end in disappointment.
I had a whole of that… until…:
If it didn’t match the first time, I don’t expect it to match the second time. I do, however, expect it to link to/merge with the other file that is identical in name, size, codec, etc.
There’s another failure point - if all your files and folders are named perfectly…
If the agents have changed - every file scanned under a new one - is brand - spanking - new - and smells like a baby (a clean one).
Two years later, can confirm it still works.
You are a damn genius.
Came here just to leave information for others looking to move their libraries around. I’ve got a 30TB plex server and I messed up moving this content once in the past already. Been searching for a while on how to properly do this without the need of hand correcting anything. A large section of it is foreign content so redoing all the custom entry work is not a pleasant experience. (a tedious twelve+ hour shift hand fixing meta data and over twenty-four hours of spiked CPU time rescanning everything)
This time I was moving the content to a new server with a completely new operating system and a different raid structure. (although both are windows based) What I did first was backup the installation files, example: “C:\Program Files (x86)\Plex”. Next I backed up the application data, example: “C:\Users\YourAccount\AppData\Local\Plex Media Server”. Next I backed up the registry, example: “HKEY_CURRENT_USER\Software\Plex, Inc.\Plex Media Server”. Finally I copied all the actual content from the old server to the new one. Just a straight transfer like from “D:\Movies” to “F:\Movies” and so on.
Then on the new machine I installed the newest plex media server version but didn’t open it afterwards. I imported the registry backup. I replaced the installation files with my backup after deleting the original folder. Then I copied in the application data which side note, you will not have a folder to delete beforehand as you’ve yet to run the program to generate the folder in the first place. Then I started the plex media server software, went to configuration, and added the new locations of the media to each library section. As soon as you hit save it will attempt to start a scan which I would cancel immediately.
Once adding in all the new locations (without removing the old ones) I started a complete library scan. After it was finished I went into configuration and removed the old library locations and started another complete scan. This worked perfectly. All content is just as I had it before transfer to it’s new home. Not a single correction needs to be made. I know this has been pointed out several times already as the new official though slower way of properly doing this. Though I wanted to chime in to let others know, yes this method does work and incredibly well.
If I was to add any other notes on the process I’d say be prepared for your application data backup to take a while. Mine is over 500GB in size and a million+ files deep. While the bulk of the transfer went rather quick, when it hit all the tiny meta data segments it really slowed down even on nvme raid. The transfer bar inside windows went from “five minutes remaining” to “over an hour remaining” the second it hit that section. Don’t be worried, it’s just alot to get through. /cheers
Thanks for your post. Currently also in a server migration and running while I’m doing everything the same as you: have the original folder working (even if it’s an internal network share), then add the duplicate folder, have it find everything as duplicates, then delete the old folder.
However, in my case, PMS finds only 10% of it all as duplicates. Even really screwing up matches (e.g. Taken 1 and Taken 2 are properly in the library from the old location. From the new location, it adds Taken 1 and Taken 2 together in a single library entry called Taken 3!?)
I’m really disappointed that it can’t be more straight forward than this. A more useful feature would be to introduce a batch “relocation” tool where we could have the tool read the XML data from the entire database and everywhere it says “O:\Movies” rename it to “W:\Movies”
Or even a file manager within Plex that can transfer the movies across HDDs / folders by itself and update the library automatically once an item has finished transferring (to limit downtime and assure seamless transition for users.)
Coming in late to this thread, but wanted to reply to this specific note based on my recent experience. To relocate my media I have been following the copy-scan-delete-scan-empty trash procedure with mostly good success. However, on occasion the scan after the initial copy wouldn’t link the item in the new location with the item in the original location. In other words, I was not left with a single item in the library with a ‘2’ indicator (as desired), but rather two separate items that have identical media content but different metadata (sometimes different in non-obvious ways). Deleting the original item left only the new one, meaning I had to update the metadata, poster, etc. (as well as losing viewing history) as others have experienced.
I found I could remedy this before deleting the original and emptying the trash, by doing the following:
- Go to the library view in the Plex UI and switch to list view (easier to see what’s happening than grid view) and sort by name
- Find the the two items (original and new)
- Select the original item first (important) and then select the new item
- Choose the Merge action and confirm, then deselect the newly merged single item
This has the effect of linking the new item to the old item, preserving all the metadata (including viewing history) of the original. You can then delete the original and empty the trash, and the new item will retain the desired metadata.
I can understand why modifying the database might be more convenient when lots of copied/moved media are affected, but hopefully this will help people who have only a relative handful of mismatched items after the copy/move. I’ve moved libraries with thousands of items and typically end up with 10 or so items that need to be ‘fixed’ as above, typically items where I have customized metadata and the matching algorithm doesn’t think the new item is the same as the old. Anyway, I hope this helps.
It’s possible that the original movie was matched using a different agent. For example, if you normally use the Plex agent and for some reason used TheMovieDB agent for that specific movie, then these steps would not cause a match since they used different agents.
It’s also possible that one of the movies got matched to a slightly different version of the movie. For example, if IMDB changes their ID on a movie, that would cause the new match to use the new ID while the old match still had the old ID.
If you are ever interested in looking into this, the next time you see 2 separate movies, check the XML and find the GUID. I’m pretty sure these will be different and explain why they didn’t get combined.
Thanks for this tip - I’ll take a look next time it happens.
Most of my ‘mismatches’ are not unexpected. I change the metadata title of a movie that is “remastered” or the like, and it’s usually these that aren’t matched correctly when copied. But not always, so I’ll start checking the XML GUID to see what clues it offers.
Hi
I dont know whether you check this still
But I couldnt find that option in v 0.3.2
Thanks
Are you referring to the tool I had before? I haven’t looked at that in years. I don’t remember what was even in there. If you don’t see it, then it’s not there.