Inclusion of a module for moving elements between libraries

Hello,

I’ve been using PlexMediaServer for over 10 years, and I’ve encountered multiple issues with moving thousands of files from one library to another for proper cataloging purposes (e.g., moving movies from a general movie library to a horror library). Doing this manually is a horrendous task and requires first locating the files (looking at which ones they are in Plex), moving them, and recataloging them in the libraries.

When there are five or six files, it’s possible, but in very large libraries (like mine, for purely conservative reasons), it’s not very feasible.

Could we consider a specific module integrated with Plex that would perform the task of moving the file from one library to another by selecting the movie or series, physically moving the file or directory (whether on Windows, Mac, or Linux) and changing the corresponding information in the database?

For example, a script for moving between HD movies and horror movies according to classification is this:

CODE:

#!/bin/bash
echo “Iniciando movimiento de películas de terror a su ubicación correspondiente.”

Ruta de la base de datos SQLite3

DATABASE_PATH=“/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db”

Array de consultas SQL

SQL_QUERIES=(
“SELECT media_parts.file FROM metadata_items JOIN media_parts JOIN media_items WHERE metadata_items.library_section_id=6 AND metadata_items.id=media_items.
metadata_item_id AND media_items.id=media_parts.media_item_id and metadata_items.tags_genre like ‘%Terror%’;”
“SELECT media_parts.file FROM metadata_items JOIN media_parts JOIN media_items WHERE metadata_items.library_section_id=6 AND metadata_items.id=media_items.
metadata_item_id AND media_items.id=media_parts.media_item_id and metadata_items.tags_genre like ‘%Terror%’;”
“SELECT media_parts.file FROM metadata_items JOIN media_parts JOIN media_items JOIN taggings WHERE metadata_items.library_section_id=6 AND metadata_items.i
d=media_items.metadata_item_id AND metadata_items.id=taggings.metadata_item_id AND media_items.id=media_parts.media_item_id AND taggings.tag_id=638;”
“SELECT media_parts.file FROM metadata_items JOIN media_parts JOIN media_items WHERE metadata_items.library_section_id=5 AND metadata_items.id=media_items.
metadata_item_id AND media_items.id=media_parts.media_item_id and metadata_items.tags_genre like ‘%Terror%’;”
“SELECT media_parts.file FROM metadata_items JOIN media_parts JOIN media_items JOIN taggings WHERE metadata_items.library_section_id=5 AND metadata_items.i
d=media_items.metadata_item_id AND metadata_items.id=taggings.metadata_item_id AND media_items.id=media_parts.media_item_id AND taggings.tag_id=638;”
)

Ruta de destino donde deseas mover los archivos

DESTINATION_PATH=“storage:/Peliculas/Terror2”

Ruta de origen a reemplazar

PATH_ORIGEN=“storage:”

Función para procesar un archivo

process_file() {
local mediafile=“$1”
if [ -f “$mediafile” ]; then
adjusted_mediafile=“${mediafile//Volumes/1f/$PATH_ORIGEN}”
rclone copy “$adjusted_mediafile” “$DESTINATION_PATH”
if [ $? -eq 0 ]; then
echo “Archivo copiado con éxito: $adjusted_mediafile”
rclone delete “$adjusted_mediafile”
if [ $? -eq 0 ]; then
echo “Archivo eliminado: $adjusted_mediafile”
else
echo “Error al eliminar: $adjusted_mediafile”
fi
else
echo “Error al copiar: $adjusted_mediafile”
fi
else
echo “El archivo no existe: $mediafile”
fi
}

Procesar cada consulta SQL

for query in “${SQL_QUERIES[@]}”; do
echo “Ejecutando consulta: $query”
sqlite3 “$DATABASE_PATH” “$query” | while read -r mediafile; do
process_file “$mediafile”
done
done

echo “”
echo “Proceso de movimiento de películas de terror completado.”
echo “”

Thanks in advance,

Alex

There’s already two related suggestions;

  1. moving individual items → [Feature Request] Moving media between libraries without losing metadata using UI
  2. moving library segments (e.g. based on folders) → [Feature request] I would like a feature to move, separate, combine, or split libraries in Plex via a wizard

Please comment/vote in those suggestions in order to help us avoid distracting or cannibalizing votes.
Unless I’m missing some unique aspect of your suggestion I’ll close this thread as a duplicate.

Thank you very much, I hope that in the near future we will have these functionalities. :wink:

Hi Tom,

Just a question… those Feature Requests are from 2021 and 2020. Don’t you think that’s too long a time for a new feature?

Thanks in advance.

Alex

It’s feature suggestions. There’s no guarantees they will all be implemented, especially with many conflicting suggestions. In the end it’s up to Plex to decide their design choices / priorities.

2025 clean-up: duplicate(s)