Complete Radarr library organization solution that renames both folders AND files with intelligent quality detection, smart logging, and robust error handling.
Radarr's standard renaming is limited and frustrating. Here's what you get with this script that Radarr can't do:
- Radarr:
Iron Man (2008)andAvengers Endgame (2019)sit randomly in your library - This script:
Marvel Cinematic Universe (2008) - Iron ManandMarvel Cinematic Universe (2019) - Avengers Endgame
Now all Marvel movies group together alphabetically. Same for DC, Star Wars, Harry Potter, etc.
- Radarr: Foreign movies keep English titles even when you prefer the original
- This script: Spanish movies show Spanish titles, English movies show English titles
Perfect if you're bilingual or prefer original titles for foreign films.
- Radarr: Quality formatting is inconsistent and ugly
- This script: Clean
[1080p],[2160p],[720p]tags that work with every quality profile
- Auto-rename: Add as Radarr custom script - renames new downloads automatically (folders + files)
- Bulk processing: Process your entire library in one command (tested with 9000+ movies)
- Dual renaming: Both folder structure AND file names get properly organized
- Radarr: Only basic renaming, OS-dependent limitations
- This script: Works on Windows, Linux, and macOS with proper dependencies
- Radarr: Fixed naming patterns, can't easily toggle features
- This script: Toggle collections on/off, quality tags on/off, configure languages independently
- Radarr: If movie has no collection, you get ugly empty placeholders:
" - (2019) Movie Title []" - This script: Adapts the pattern automatically:
- With collection:
Marvel Cinematic Universe (2008) - Iron Man [1080p] - No collection:
Iron Man (2008) [1080p](clean, no empty dashes)
- With collection:
- Radarr: Limited metadata sources
- This script: Pull native language titles directly from TMDB when needed
Radarr's naming problem: If you set a pattern like {Movie Collection} - ({Release Year}) {Movie Title} [{Quality Title}] but the movie has no collection, you get ugly empty placeholders:
- (2008) The Dark Knight [] # Empty collection and quality placeholders
- (2019) Joker [] # Looks broken and unprofessional
This script adapts intelligently:
Marvel Cinematic Universe (2008) - Iron Man [1080p] # Has collection
The Dark Knight (2008) [1080p] # No collection, clean format
Joker (2019) [1080p] # No empty dashes or brackets
Instead of random download names:
Iron.Man.2008.1080p.BluRay.x264-GROUP/
The.Dark.Knight.2008.IMAX.1080p.BluRay.x264-SECTOR7/
avengers_endgame_2019_4k_hdr_atmos/
- Back up your Radarr database (seriously, do this first)
- Edit
config.envwith your Radarr URL and API key
- Preview what would be changed:
.\run.ps1 -MaxMovies 5 -DryRun - Test with a few movies:
.\run.ps1 -MaxMovies 5 - Process everything:
.\run.ps1 - Resume after interruption:
.\run.ps1 -Skip 100(continues from movie #101)
💡 More examples and detailed usage: See CHANGELOG.md for comprehensive feature documentation.
Copy and edit config.env:
# Your Radarr setup
RADARR_URL=http://127.0.0.1:7878
RADARR_API_KEY=your_api_key_here
# Language preferences (leave NATIVE_LANGUAGE empty for English-only)
NATIVE_LANGUAGE=es # Spanish movies show Spanish titles
FALLBACK_LANGUAGE=en # English movies show English titles
# Logging configuration - smart logging prevents oversized logs
LOG_LEVEL=NORMAL # MINIMAL/NORMAL/DETAILED/DEBUG (see details below)
LOG_CUSTOM_FORMATS=false # Keep false - prevents log spam
LOG_QUALITY_DEBUG=false # Keep false - reduces noise
LOG_LANGUAGE_DEBUG=false # Keep false - reduces noise
# Folder naming options - toggle what you want
USE_COLLECTIONS=true # true: "Collection - Title", false: just "Title"
INCLUDE_QUALITY_TAG=true # true: add [1080p], false: no quality tags
UPDATE_FOLDER_TIMESTAMP=false # true: update folder dates, false: preserve original
# File renaming (renames both folders AND files)
ENABLE_FILE_RENAMING=false # Enable Radarr-compatible file renaming
FILE_NAMING_PATTERN="{Movie.CleanTitle}.{Release.Year}.{Quality.Full}.{MediaInfo.VideoCodec}.{MediaInfo.AudioCodec}.{MediaInfo.AudioChannels}-{Release.Group}"
# Optional TMDB integration for better native language titles
TMDB_API_KEY=your_tmdb_key # Leave empty to disable
# System paths (adjust for your OS)
SCRIPTS_DIR="C:\Scripts\radarr-renamer" # Where scripts are located
LOG_FILE="C:\Scripts\radarr-renamer\logs\rename-radarr-folders.log" # Log file location
GIT_BASH_PATH="C:\Program Files\Git\bin\bash.exe" # Git Bash executable
# Linux/macOS examples:
# SCRIPTS_DIR="/home/user/scripts/radarr-renamer"
# LOG_FILE="/var/log/rename-radarr-folders.log"
# GIT_BASH_PATH="/bin/bash"Choose the right logging level for your needs:
- MINIMAL: Only errors, warnings, and final results (production use)
- NORMAL: Above + success messages and important info (recommended)
- DETAILED: Above + process steps and decisions (troubleshooting)
- DEBUG: Everything including technical details (development only)
- ENABLE_FILE_RENAMING=false: Only renames folders (default, safest)
- ENABLE_FILE_RENAMING=true: Renames both folders AND movie files using Radarr's API
With these settings you get different results:
# USE_COLLECTIONS=true, INCLUDE_QUALITY_TAG=true
"Marvel Cinematic Universe (2008) - Iron Man [1080p]"
"The Dark Knight (2008) [1080p]" # No collection = no empty placeholder
# USE_COLLECTIONS=false, INCLUDE_QUALITY_TAG=true
"Iron Man (2008) [1080p]"
"The Dark Knight (2008) [1080p]"
# USE_COLLECTIONS=true, INCLUDE_QUALITY_TAG=false
"Marvel Cinematic Universe (2008) - Iron Man"
"The Dark Knight (2008)"
# USE_COLLECTIONS=false, INCLUDE_QUALITY_TAG=false
"Iron Man (2008)"
"The Dark Knight (2008)"The package includes helpful diagnostic and maintenance scripts:
check-git-bash.ps1 -Fix: Auto-detects Git Bash installation and fixes configuration issuesclean-logs.ps1 -Compress: Compresses oversized log files while preserving important informationget-movie-ids.ps1: Lists all movies in your Radarr library for testing purposes
# Process all movies in your library
.\run.ps1
# Test with 10 movies first (recommended)
.\run.ps1 -MaxMovies 10
# Resume after interruption (skip first 100 movies)
.\run.ps1 -Skip 100
# Skip first 50, then process next 25 movies
.\run.ps1 -Skip 50 -MaxMovies 25Target specific movies instead of processing everything:
# See what movies would be processed (no changes made)
.\run.ps1 -FilterPath "[Unknown]" -DryRun
# Process only movies with "[Unknown]" in folder path
.\run.ps1 -FilterPath "[Unknown]"
# Process movies without quality defined (no files or Unknown quality)
.\run.ps1 -FilterNoQuality
# Process movies added in the last 7 days
.\run.ps1 -DaysBack 7
# Process movies with specific text in title
.\run.ps1 -SearchTitle "Marvel"
# Combine filters for precise targeting
.\run.ps1 -FilterPath "temp" -FilterNoQuality -DaysBack 30
# Process movies in download folders
.\run.ps1 -FilterPath "downloads" -MaxMovies 20 -DryRun# Fix movies in temporary folders
.\run.ps1 -FilterPath "temp"
.\run.ps1 -FilterPath "tmp"
.\run.ps1 -FilterPath "downloads"
# Fix movies with broken quality detection
.\run.ps1 -FilterPath "[Unknown]"
.\run.ps1 -FilterPath "Unknown"
.\run.ps1 -FilterNoQuality
# Process recent additions only
.\run.ps1 -DaysBack 3 # Last 3 days
.\run.ps1 -DaysBack 7 -MaxMovies 50 # Last week, limit 50
# Target specific collections or patterns
.\run.ps1 -SearchTitle "Marvel" -DryRun
.\run.ps1 -FilterPath "2024" # Movies with "2024" in path
.\run.ps1 -FilterPath "4K" # 4K movies needing organization| Filter | Description | Example |
|---|---|---|
-FilterPath "text" |
Movies with specific text in folder path | .\run.ps1 -FilterPath "[Unknown]" |
-FilterNoQuality |
Movies without quality defined | .\run.ps1 -FilterNoQuality |
-DaysBack N |
Movies added/modified in last N days | .\run.ps1 -DaysBack 7 |
-SearchTitle "text" |
Movies with text in title | .\run.ps1 -SearchTitle "Marvel" |
-DryRun |
Preview what would be processed | .\run.ps1 -DryRun |
-MaxMovies N |
Limit processing to N movies | .\run.ps1 -MaxMovies 10 |
-Skip N |
Skip first N movies | .\run.ps1 -Skip 100 |
# Radarr calls this automatically on import/upgrade
rename-radarr-folders.bat movieID "Movie Title" year "Quality"Both methods use the same logic, just different triggers.
Important: The script provides intelligent folder organization with optional file renaming capabilities.
- Reads your movie data from Radarr API
- Applies smart quality detection with precise TC/CAM pattern matching
- Checks if movie is in your native language preference
- Gets the appropriate title (original for native language, English for others)
- Builds intelligent folder name:
Collection (Year) - Title [Quality] - Organizes folder structure with configurable collection and quality options
- Optionally renames files using Radarr's native API (if enabled)
- Updates Radarr database with new folder path and triggers refresh
Example workflow:
Folder Mode (ENABLE_FILE_RENAMING=false):
Before: Iron.Man.2008.1080p.BluRay.x264-GROUP/
├── Iron.Man.2008.1080p.BluRay.x264-GROUP.mkv
└── Iron.Man.2008.1080p.BluRay.x264-GROUP.srt
After: Marvel Cinematic Universe (2008) - Iron Man [1080p]/
├── Iron.Man.2008.1080p.BluRay.x264-GROUP.mkv # Files keep original names
└── Iron.Man.2008.1080p.BluRay.x264-GROUP.srt # Perfect for manual management
File Renaming Mode (ENABLE_FILE_RENAMING=true):
Before: Iron.Man.2008.1080p.BluRay.x264-GROUP/
├── Iron.Man.2008.1080p.BluRay.x264-GROUP.mkv
└── Iron.Man.2008.1080p.BluRay.x264-GROUP.srt
After: Marvel Cinematic Universe (2008) - Iron Man [1080p]/
├── Iron.Man.2008.1080p.h264.DTS.5.1-GROUP.mkv # Renamed with MediaInfo
└── Iron.Man.2008.1080p.h264.DTS.5.1-GROUP.en.srt # Complete organization
With NATIVE_LANGUAGE=es:
- Spanish movie: "El Laberinto del Fauno" →
El Laberinto del Fauno (2006) [1080p] - English movie: "The Dark Knight" →
The Dark Knight (2008) [1080p] - French movie: "Amélie" →
Amélie (2001) [720p](uses original title)
├── config.env # Your configuration
├── run.ps1 # Bulk processing script
├── rename-radarr-folders.bat # Individual movie processing (folders)
├── rename-radarr-folders.ps1 # PowerShell wrapper
├── rename-radarr-folders.sh # Main folder logic (bash)
├── rename-radarr-folders # Shell script for Linux/macOS compatibility
├── rename-radarr-files.sh # File renaming logic (bash)
├── get-movie-ids.ps1 # List your movies for testing
├── get-single-movie.ps1 # Single movie processing utility
├── check-git-bash.ps1 # Diagnostic tool for Git Bash
├── clean-logs.ps1 # Log management utility
├── README.md # This documentation file
├── CHANGELOG.md # Version history and release notes
└── logs/ # Detailed logs
Add this as a custom script in Radarr Settings > Connect:
- On Import: Automatically rename new downloads
- On Upgrade: Rename when quality improves
- On Rename: Triggered when you rename through Radarr UI
- Path: Point to
rename-radarr-folders.bat
This way new movies get organized automatically while you can bulk-process existing ones with run.ps1.
- Preview mode: See what would be changed without making any modifications (
-DryRun) - Selective processing: Target specific movies instead of processing everything
- Extensive logging: Every operation is logged with timestamps
- Error handling: Won't break if a movie fails - continues with remaining movies
- Batch testing: Test with small batches first (
-MaxMovies) - Resume capability: Continue from any point after interruption (
-Skip) - Rollback friendly: Radarr database backup lets you undo everything
- Diagnose Git Bash Issues:
.\check-git-bash.ps1 -Fix(auto-detects and fixes Git Bash configuration) - Clean Oversized Logs:
.\clean-logs.ps1 -Compress(reduces log file sizes while preserving important info)
# See movies that need fixing without making changes
.\run.ps1 -FilterPath "[Unknown]" -DryRun
.\run.ps1 -FilterNoQuality -DryRun
# Fix most common issues
.\run.ps1 -FilterPath "[Unknown]" # Fix folders with [Unknown]
.\run.ps1 -FilterNoQuality # Fix movies without quality
.\run.ps1 -DaysBack 7 # Fix recent additions only"Git Bash not found": Install Git for Windows or update GIT_BASH_PATH
"API key invalid": Get your API key from Radarr Settings > General
"jq not found": Install with winget install jqlang.jq (Windows) or your package manager
"Script not found at: \rename-radarr-folders.sh": This happens when ${SCRIPTS_DIR} variable expansion fails in config.env. Make sure your SCRIPTS_DIR path ends with a backslash (\) on Windows or forward slash (/) on Linux/macOS, and doesn't contain spaces in the middle without proper quoting.
"Script exited with code: 2" in Radarr: Usually means the batch script can't find the shell script. Check that all paths in config.env are correct and that Git Bash is properly installed.
Movies not updating: Check the log file for detailed error messages
- Git Bash (comes with Git for Windows)
- PowerShell 5.1+ (usually pre-installed)
- bash, curl, jq (install via package manager)
- PowerShell Core (for bulk processing with
run.ps1)
- bash (pre-installed), curl, jq (via Homebrew)
- PowerShell Core (via Homebrew:
brew install --cask powershell)
- Radarr: Any recent version with API access
- TMDB API key: Optional, for enhanced native language support
These scripts evolved from personal frustration with Radarr's limited renaming. Started simple, grew into something that handles edge cases like:
- Movies with apostrophes and special characters
- Collection detection and grouping
- Multiple quality profiles
- Bilingual libraries
- Batch processing thousands of movies
Feel free to fork and adapt for your setup. The bash script (rename-radarr-folders.sh) contains the main logic if you want to understand or modify the behavior.
- Renames movie folders with intelligent naming patterns and quality detection
- Moves all files to the new organized folder structure
- Updates Radarr's database to point to new folder location
- Triggers Radarr refresh to detect files in new location
- Smart logging with configurable verbosity levels
- Rename movie files using Radarr's native API (
ENABLE_FILE_RENAMING=true) - Apply Radarr naming patterns to individual video and subtitle files
- Extract MediaInfo details for enhanced file naming
- Rename or delete extra files (
RARBG.txt,sample.mkv, etc.) - Modify video file content, metadata, or quality
- Change Radarr settings or configuration
- Delete anything from your system
- Process files outside of Radarr's library
Folder Mode (default):
- This script:
Random.Movie.2023.x264-GROUP/→Action Collection (2023) - Movie Title [1080p]/ - Files moved unchanged: All
.mkv,.srt,.nfofiles keep original names - Radarr triggered: Receives refresh command and detects files in new location
File Renaming Mode (if enabled):
- Folders organized: Same intelligent folder structure as above
- Files renamed: Uses Radarr's API to rename files with proper patterns
- MediaInfo extracted: Video/audio codec and quality details included in filenames
Result: Perfect folder organization + optional comprehensive file naming = Complete library organization
When moving from unorganized to organized structure:
- Test first: Use
-DryRunwith a small subset - Process by quality: Start with high-quality files (
-FilterPath "1080p") - Handle problematic movies: Fix
[Unknown]and missing quality tags - Collections last: Process collection-based movies after individual titles are clean
For libraries that are mostly organized:
- Weekly: Process recent additions (
-DaysBack 7) - Monthly: Clean up download folders (
-FilterPath "downloads") - As needed: Fix specific collections or quality issues
For large libraries (1000+ movies):
- Process in chunks: Use
-MaxMoviesand-Skipfor manageable batches - Target specific issues: Focus on movies with quality problems first
- Collection by collection: Organize Marvel, DC, Star Wars separately for better control
Built by someone tired of manually organizing movies. Extensively tested and proven on a library of 9000+ movies - a mix of 4K remuxes, 1080p rips, and random quality downloads across multiple languages.
Made this public because folder organization shouldn't be this hard.