Rename library folder/directory

PMS is running fine on my Mac Mini, but I want to rename one of the library folders, ie a folder that contains (movie) media and the Movie library is set to that folder. I just want to rename the folder and avoid Plex having to rescan everything.

If I rename the folder, will Plex pick up the change and report the new folder name in the Library settings? Or will it simply lose contact with the files?

Is there any way to edit PMS’s settings, i.e. Quit PMS, edit the folder name in a config file and on restarting PMS it will just use the new folder, like you can in iTunes?

No. Plex won’t know that the folder was renamed.

No. PMS tracks each file individually. There isn’t a single setting to update the folder.

Read the last couple of comments in [HowTo] Plex database modification - Moving media the right/wrong way - #85 by doncaruana. It deals exactly with what you want.

Thanks, a good thread that I’d not previously found. However, there are 3 methods mentioned:-

  1. Official Plex method, i.e. copy media files to new folder, add to Library then remove old one.

  2. Edit SQLite database (now fewer tables than when first explained)

  3. Add new location to Library, then MOVE files there and remove old one from Library config.

Many posts state 1. doesn’t work well, yet the final post in that thread suggests that as the way to do it. I’ll figure it out, but the best way to achieve this is still far from clear. It is obvious some simple database editing could achieve the desired result, but even after all the years of users asking how to do this, the Plex developers can’t be bothered to add this as an option. Why make users have to jump through hoops like this when it would be so easy to incorporate it as a PMS admin option.

The concept seem simple, but it’s not really. Moving media files to another location is not something that is done very often and the amount of effort needed to implement a function that may be used by some users every couple of years, it’s just not a priority at this time.

There are a couple of feature requests for this, but as you can see, the demand is not high. You can add your vote.

Most posts to that thread indicate that #1 is what does NOT work. Since there are multiple posts saying #2 and/or #3 did work, can you explain why you say neither work?

In particular, how can #2 NOT work? That is THE information PMS uses to locate the actual files. So how can changing that in the database not simply make PMS see the files in the new location?

I realise messing with SQL isn’t for the faint hearted (from which, as a former SQL database developer I don’t suffer) but that is not the same as saying it does not work. Please explain.

I disagree. It is very simple. Just a few lines of SQL will direct PMS to look in the new location for the files. It only becomes more complicated when users are trying to do this ‘externally’. If it were implemented ‘internally’ in PMS, any small wrinkles could be eliminated and the process updated in sync with any changes to the SQLite database.

I think that’s more a case of the feature doesn’t exist, so users put up with not having it. In the great scheme of managing and manipulating what can be a very large and complex folder/file structure of all the media, not being able to simply rename the main library folders is a notable lack. Make this a simple (yes it really is simple) admin function and users would appreciate it and make use of it.

In my case I can do it pretty simply as there are not that many movies involved and no special metadata edits, so I could just set it all up again and let PMS do all its scanning and indexing all over again. But I hate that sledgehammer approach and prefer to find out how to simply get PMS to recognise the different folder name. If nothing else I get to know more about PMS’s database. :slightly_smiling_face:

I do however think this ought to be a built-in function.

Well, you are changing an entire library and the last time I did that was when I consolidated 28 of them into 1 - so it would be compatible with Plex… as it’s designed.

If fiddling with a Library after creation is buggy or inconvenient - I’m shocked.
That never happens.

Thanks, but with respect, saying one of them works for you is not necessarily proof of perfect functionality and is in fact contrary to most other posts on this topic. It also does not explain why the other 2 methods do not work with many posts stating that ‘moving’ the files worked when ‘copying’ them did not.

The real question is how modifying the SQLite database to re-direct from the old to the new location does not work perfectly. PMS would simply not know there had been any change to the locations and so NOTHING else could possibly be affected. No changes to ‘Recents’, nor losing any special metadata edits. How would it know there had been any change?

I realise #1 works for you, but I am trying to understand why you think #2 (SQL edit) will not work. What reasons do you have for that? What evidence that that is the case?

I’m not trying to be argumentative, but if #2 truly does not work, then PMS must be doing something other than storing the locations in the SQLite database and if so, I’d like to know what.

Sorry, you lost me there.

…and there.

Yes, well… as I said in my edit above - and tried to remember when I did anything with an entire library - I recall I melted it all down and started over.

Probably because it wasn’t working out like I thought it would.

At that time I was tired of Battling Plex while trying to use more than one of any library type - so a major overhaul from many down to ‘One Each’ was quite traumatic.

Since then, after the healing and therapy, it’s been a battle with Collections or Drilling for Genre so Plex is nothing, if not exasperating. Plex doesn’t design Plex like Plex Users are using it - and they’re not that interested in finding what the differences are.

I do wish you luck.
We all need it.

Apologies for the slight de-railing…lol

Just to clarify, in this instance I am simply wanting to change the name of the folder that contains the movie media and is obviously stored by PMS as that Library’s folder. However, just a simple rename is no different from wanting to change the Library to an entirely different location. This is really what needs to be done.

  1. Quit PMS
  2. Edit config files to point Library to new folder
  3. Start PMS

PMS will then work exactly as before, but be looking in a different folder for that media. It will however NOT know it is doing so and therefore nothing else can have changed.

The questions are why this may not work and that is purely down to making sure that ALL references to the old location are changed to the new location. If that is done that I fail to see how it could not work. If some config data is missed, then I can see how that might screw things up. In which case, we need to know what that missed data is and where it is located so it can be changed along with the rest. However, at this point, I have seen nothing that indicates this method does not work which rather implies that no location config data is being missed.

I am still trying to determine exactly what about the SQL edit method that doesn’t work.

Yes indeed, I do understand your pain. Plex infuriates me at times too. Made worse by there being no apparent way to convey ones grievances to the devs. However, as a (former) database developer, the obvious approach to me is to simply edit the database. If done correctly, I cannot see how it wouldn’t work.

I will ensure that I only work on a copy of that SQLite database so if I do screw up, I can easily just revert to the working one.

In any case, I am also moving to an entirely new media server so if I completely screw that up (unlikely) I can just grab the old config again, in its entirety. Until I get it right. I may end up with a sore head, but I WILL make the brick wall fall down. :slightly_smiling_face:

Sure the actual SQL command is simple. But that assumes nothing is happening with the database at the time. Just blindly running SQL commands is not safe and why Plex doesn’t recommend users do it. Imagine a user trying to rename their folder from movies to Movies: Archive. That’s not valid for Windows, but it is for other OSes. SQL won’t care and then the files don’t work.

There are other implications besides just issuing an SQL command.

Hold on, PMS knows exactly on what it is running and therefore what is and is not possible. Also, other database access clearly needs to be halted while the adjustments are undertaken. As I stated above, halt PMS while the edits are done.

In any case, the above is only a potential issue when users are attempting this ‘externally’, i.e. independently of PMS. If it is actually Plex code doing all this, these things become a non issue, as indeed I stated above “If it were implemented ‘internally’ in PMS, any small wrinkles could be eliminated”. Plex devs know exactly what needs to be done and how to do it and if implemented as an ‘internal’ function, then there would be no possibility of error on the part of the user.

In fact, I kinda doubt any user contemplating executing SQL commands on their database would not be aware of how to correctly construct the new path, but having PMS execute the entire function would ensure all is done correctly.

A revision of my earlier steps for manual implementation:-

  1. Quit PMS
  2. Move media files to new location
  3. Edit config files to point Library to new folder
  4. Start PMS

I’m not holding my breath for this to be incorporated into PMS as I’m happy to do it myself, but for other users’ sake, I firmly believe this should be a function within PMS. Especially as it IS very easy to implement.

I was actually reminded of this topic this morning when I received an email about playing old games within Plex? Something like that. I didn’t really read it as I have NO INTEREST whatsoever in crap like that. But it disheartens me to see the devs wasting all their time on that sort of thing that quite frankly NO-ONE as asking for on these forums, while very simple functions like being able to move a library folder have been repeatedly requested for many years yet totally ignored.

This is a continuous grievance with users of any sort of code driven system. That the developers of that code ignore what is being requested and just churn out new features that no-one was asking for. Obviously just because that’s what THEY wanted to work on. But that’s not the way to maintain your user base and hence revenue stream. If you must, add those fripperies AFTER it actually contains the core functionality that users need and want.

But that’s just my opinion from using computers for the last 40 years and having been a developer myself for some of that time. So what do I know.

I can now confirm the SQL edit process really is as easy as I expected.

I first tried the ‘official’ Plex method of copying all the media to the new location, but since it was totally impractical to find space to duplicate 5 TB (storage location not changing, just need to change a folder name) I just made a symlink and Plex would see that as a copy at the new path. Apart from that, it’s dreadfully slow and each library would take an unacceptably long time to re-scan and add the new folder. With half a dozen libraries to update (just to change the name of the storage folder) and one could take nearly an hour, then when I saw that in many cases PMS had NOT matched every item. So some entries were not showing that ‘2’ flag on the icon. Some were simply displayed twice and not matched up. I gave up. Not only was this official method way too slow to be of any real use (for what is after all a VERY simple change), but it was also screwing up.

So I grabbed DB Browser and had a go at editing the paths in the SQLite database. I tried a few edits, but then it crashed. When I opened it all up again, the edits had not been saved. I then noticed there is an extra button to click in order to actually save the changes (unusual when dealing with SQL). So I made the same 2 edits and saved the changes. Then it crashed. Only one of the edits had actually been saved.

I tried saving and closing the database after each edit, but mostly it crashed before I had the chance. So in the end I gave up with that.

I then used SQLPro for SQLite, which I have previously used successfully with SQL databases. This has no extra ‘Commit’ step, but it worked perfectly and never crashed so in a short time I had everything updated to the new paths as I require.

Re-started Plex and everything is correct and all content accessible at the new locations (just new names, not actually moved at all).

So if I ever need to do it again, I wouldn’t waste my time on the official method and instead go straight to using a good SQLite editor and directly update the database. Works perfectly. How can it not. I would add however that if you’re not comfortable editing SQL databases, this method is probably not for you. Which rather suggests…

Plex really should incorporate this as part of PMS. It’s not complicated and after typing in the new paths (the interface for this would need thought) the actual database changes take seconds - literally.

There would need to be some care taken, like e.g. the new paths MUST already exist with the data in place and the database would need to be locked from other Plex usage and then re-read, like stopping and re-starting Plex. However, this is easy for the actual Plex devs as they can make Plex do whatever they need.

Now Plex is configured with the correct paths, I’m moving everything to the actual new media server. Make no mistake, it takes a LONG time to transfer 5 TB from one server to another, even on a local Gigabit network. Ho hum…

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.