SolvedRadarr Bulk folder rename does not work, requires one-by-one update

I decided to have all my movie folders automatically renamed.

I read whatever instructions I could find, including:
https://github.com/Radarr/Radarr/wiki/Sorting-and-Renaming
#1509
#353

I changed the settings to enable folder rename, and static path to no.
I updated the library.
I bulk edited all movies to static path no.
I updated the library again.

I found folders that did not get renamed, e.g.
\STORAGE\Media\Movies\Movies\Aeon Flux (2005)\Æon Flux (2005).mkv

When I edit settings of a movie where the folder did not rename.
The movie is not monitored, expected.
The static path is set to no, per the bulk change.
The filename is correct, but the folder name is wrong.

If I preview rename, the rename says all work is done, while the folder is still incorrect.
If I refresh the movie, not a bulk refresh, just the one movie refresh, then suddenly the folder is renamed.

It looks like the bulk refresh does not update folders.
I expect that enabling auto rename, and setting the path to not static in bulk, and then refreshing, would rename all folders.

(I really expect the folder to be renamed, instead a new folder is created, only one movie file copied, that leaves orphan files, but this is already logged)

Radarr Version: 0.2.0.870

Screenshots before and after refresh attached.
2017-10-25 1
2017-10-25 2
2017-10-25 3

Logs:
logs.zip

36 Answers

✔️Accepted Answer

Hi guys,

Came across this github issue when looking to do a bulk-rename myself and ended up writing a bash script to do the job for me against the Radarr API.

For those who don't want to manually rename thousands of files (like me) here's a quick and dirty script I wrote that will do the job... Be sure to set your Radarr API Key, Host & Port before running...

#!/bin/bash
#
# Quick and dirty script to hit the Radarr API and rename any movies ...

RADARR_API_KEY="xxxxxxxx"
RADARR_HOST="127.0.0.1"
RADARR_PORT="7878"

################################################################################################

jqInstalled() {
    if ! [ -x "$(command -v jq)" ]; then
        echo 'Please install the JQ tool to: [/usr/bin/jq], before running this script. Download JQ at: https://stedolan.github.io/jq/' >&2
        exit 1
    fi
}

# Check JQ Installed first..
jqInstalled

echo "NB: Script may take some time to execute if you have thousands of movies in Radarr, please be patient ..."
TOTALITEMS=`curl -s -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -H "X-Api-Key: $RADARR_API_KEY" \
    -X GET http://$RADARR_HOST:$RADARR_PORT/api/movie`

i=0
total=`echo $TOTALITEMS | jq '. | length'`

for row in $(echo "${TOTALITEMS}" | jq -r '.[] | @base64'); do
    _jq() {
        echo ${row} | /usr/bin/base64 --decode | /usr/bin/jq -r ${1}
    }
    i=$((i + 1))

    MOVIENAME=`echo $(_jq '.title')`
    DOWNLOADED=`echo $(_jq '.downloaded')`
    ID=`echo $(_jq '.id')`
    FILENAME=`echo $(_jq '.movieFile.relativePath')`

    echo "Processing: $i/$total - '$MOVIENAME'"

    if [ "$DOWNLOADED" == "true" ]; then
        
        if [[ $FILENAME = *"PP-SHRUNK"* ]]; then
            echo "File has been post-processed by ffmpeg - do not rename."
        else

            RENAME_RESPONSE=`curl -s -H "Accept: application/json" \
                -H "Content-Type: application/json" \
                -H "X-Api-Key: $RADARR_API_KEY" \
                -X GET http://$RADARR_HOST:$RADARR_PORT/api/renameMovie?movieId=$ID`

            FILE_ID=`echo $RENAME_RESPONSE | jq '.[].movieFileId'`

            curl -s "http://$RADARR_HOST:$RADARR_PORT/api/command" \
                -H "Accept: application/json" \
                -H "Content-Type: application/json" \
                -H "X-Api-Key: $RADARR_API_KEY" \
                --data-binary "{\"name\":\"renameMovieFiles\",\"movieId\":$ID,\"files\":[$FILE_ID]}" >> /dev/null

        fi
    fi
done

Hope this helps some one :)
@hellfirehd, @ptr727

api-rename-radarr