# Move DVR media

**URL:** <https://forums.plex.tv/t/move-dvr-media/791539>\
**Category:** Metadata & Adding Files\
**Tags:** server-windows\
**Created:** [May 4, 2022, 11:18pm UTC](https://forums.plex.tv/t/move-dvr-media/791539 "2022-05-04T23:18:20Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ReenigneArcher](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/reenignearcher/32/276300_2.png) [@ReenigneArcher](https://forums.plex.tv/u/ReenigneArcher)\
**Post date:** [May 5, 2022, 12:47am UTC](https://forums.plex.tv/t/move-dvr-media/791539/2 "2022-05-05T00:47:12Z")

</div>

Solved this by screwing with the database.

First editing the `media_parts` table following instructions here: [[HowTo] Plex database modification - Moving media the right/wrong way - #10 by jelwell](https://forums.plex.tv/t/howto-plex-database-modification-moving-media-the-right-wrong-way/126701/10)

I didn’t have to do any of the other 4 updates in that post (I already manually updated the library paths and the others didn’t apply).

Then I had to `NULL` out the `deleted_at` values in the `media_parts` AND `media_items` tables.

No idea why scanning the library didn’t un-delete the files after it “should have” found them again. Maybe a bug in the server?

**Edit** : This took a little bit more screwing around as after a little bit the libraries with the DVRed items became completely corrupted. Good thing I copied the DB before doing anything.

I think this resolves it, starting from the original database. I ran the following commands with current directory where the database is stored (have a backup).

```nohighlight
"C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Server.exe" -sqlite "com.plexapp.plugins.library.db" "UPDATE metadata_items SET deleted_at= NULL"

"C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Server.exe" -sqlite "com.plexapp.plugins.library.db" "UPDATE media_items SET deleted_at= NULL"

"C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Server.exe" -sqlite "com.plexapp.plugins.library.db" "UPDATE media_parts SET deleted_at= NULL"

"C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Server.exe" -sqlite "com.plexapp.plugins.library.db" "UPDATE media_parts SET file= replace(file, 'L:\Libraries\Media\Videos\DVR\', 'L:\Media\Videos\DVR\') where file like '%L:\Libraries\Media\Videos\DVR\%'"

```

In the final command you’ll need to replace your original and new paths accordingly.

Basically this edit is the same as the original but I also had to `NULL` the `deleted_at` values in the `metadata_items` table. I ended up using the plex -sqlite command to do this because of a tokenizer error when attempting in DB Browser for SQLLite. This comment pointed me in the right direction ([Can no longer update library database with sqlite3 - #30 by bpalloni](https://forums.plex.tv/t/can-no-longer-update-library-database-with-sqlite3/701405/30)).

I will update this again if I have further issues, but I feel confident this is resolved this time.

---

_[View the full topic](https://forums.plex.tv/t/move-dvr-media/791539)._
