Press "Enter" to skip to content

Rtorrent magic: Moving finished torrents based on labels

So… I’ve been using rtorrent as my main torrent client for a couple of years now. I have it running on my server and I’m usually adding torrents either by placing them in a watchdir or by adding them through a web interface (rutorrent, in case you’re wondering).

One of the things I’ve always wanted was to have rtorrent handle multiple categories. I wanted games I downloaded to go into a “games” directory, comics into a “comics” directory, and so on. I’ve been looking for solutions for a few years now, and all I’ve found online are people in the same boat. So today I decided to spend a few hours experimenting… And this is the result.

The Solution

My way of doing this uses two lines of code in .rtorrent.rc:

# Add new method to get finished dir
system.method.insert = d.get_finished_dir,simple,"cat=[folder]/finished/,$d.get_custom1="
system.method.set_key =,move_complete,"d.set_directory=$d.get_finished_dir=;execute=mkdir,-p,$d.get_finished_dir=;execute=mv,-u,$d.get_base_path=,$d.get_finished_dir="

The first line, the system.method.insert thing, basically says that each torrent object should be able to return a string which is the concatenation of “[folder]/finished/” and the torrent’s label. So a torrent with the label “tvshows” will return “[folder]/finished/tvshows”. Change the first part to whatever you want your base “finished torrents” directory to be. I haven’t tried this with any directories containing spaces, but I’m guessing escaping would be the way to go.

The second line basically says that the torrent should set its internally defined directory to whatever get_finished_dir returns, then create the directory if it doesn’t already exist, and finally move the torrent to the same directory.

  • Torrents without labels will be placed in the base dir.
  • Torrents with labels corresponding to already existing folders will be moved to those folders.
  • Torrents with labels corresponding to folders that don’t already exist will have the folder created for them, then they’ll be moved to that folder.

It’s a bit complex, but hopefully my explanation makes thing a bit clearer =)

TL;DR: Insert the lines in your .rtorrent.rc, replace [folder]/finished/ with your base directory for finished torrents.

Watch directories

I have set up several watch directories, each corresponding to a category or label.

# TV shows
schedule = watch_directory_1,5,60,"load_start=[folder]/input/tvshows/*.torrent,d.set_custom1=tvshows"

# Movies
schedule = watch_directory_1,5,60,"load_start=[folder]/input/movies/*.torrent,d.set_custom1=movies"

# Comics
schedule = watch_directory_1,5,60,"load_start=[folder]/input/comics/*.torrent,d.set_custom1=comics"

# Music
schedule = watch_directory_1,5,60,"load_start=[folder]/input/music/*.torrent,d.set_custom1=music"

There are two important parts of each of these lines. The [folder]/input/x part is the directory to be watched. The last part, after set_custom1=, is the label torrents found in the directory will be assigned.

This means when I’m downloading a movie, say, then I put the torrent in the [folder]/input/movies folder. It’s automatically added to rtorrent, with the label “movies”. When finished, it’s placed in [folder]/finished/movies.

Next step for me will be to add some automatic fetching of subtitles for downloaded movies and tv shows, but I’m pretty happy with this setup…


I recently upgraded to rTorrent 0.6.9. Slight change as shown below:

# Add new method to get finished dir
method.insert = d.get_finished_dir,simple,"cat=[folder]/finished/,$d.get_custom1="
method.set_key =,move_complete,"d.set_directory=$d.get_finished_dir=;execute=mkdir,-p,$d.get_finished_dir=;execute=mv,-u,$d.get_base_path=,$d.get_finished_dir="

I haven’t tested this extensively, though. I might come back to revise this further.


I borrowed the method.insert stuff from this recipe.

The custom1 and label stuff I found in several places, but this solution is basically what I based mine on. I can’t seem to find the page where I found the information that the rutorrent labels are the same as d.get_current1 though.

I know there are addons for rutorrent (like autotools) that do similar things, but I wanted a server-based solution.

Got a better solution? Let me know and I’ll update this post & give credit!


  1. Dave Dave August 27, 2014

    Hi. Thanks for this. If I wanted to midofy it to make all downloads with no label to go to “/Other”, how would I do that?

  2. Jeremy Jeremy March 11, 2015

    Thanks, this helped a lot!
    One issue, tho, that I had to sort out…
    you can only use “watch_directory_1” one time as each subsequent use overrides the previous one. So in your example, it should be
    TV Shows line – schedule = watch_directory_1,5,60 etc
    Movies line – schedule = watch_directory_2
    Comics line – schedule = watch_directory_3
    etc etc

  3. Jon Jon April 19, 2015

    Hello, I really, really enjoy your code. It does so much more for me than you will ever know. I do have a follow up question/request if you would be willing to help me out. How would the code read if I wanted the following to happen. When I assign the torrent a label, lets say for example ” Always seed TVHD” how could I get it to put into a directory automatically that would be setup like this, which basically is just one more folder then you have, downloads/finished/Always_Seed/TVHD the first director is of course the default location of where all my torrents go to. This is a another example of the same thing, lets say I want to label a torrent “Seed to 1 TVHD” and it download automatically to a folder located here downloads/finished/Seed_to_1/TVHD. Basically I am just adding in a extra folder that was spoken of in your script and wondering how to do this,

    • krank krank April 23, 2015

      Sorry, I haven’t really been tinkering much with this code as of late. I’ve forgotten most of it, and anyways part of it stopped working and I just gave up on the whole thing. Sorry I can’t help you!

  4. Me Me May 23, 2015

    Hey, this works in Debian Jessie’s rtorrent (0.92/0.13.2) and latest ruTorrent. Thanks for the tip.

  5. guest123 guest123 June 20, 2015

    Thank you for this!

  6. chnateag chnateag July 9, 2015

    Where is this guys ? LET ME PAY HIM A BEER !!

  7. guest12311 guest12311 July 20, 2015

    Thank you for posting this

  8. kevin kevin August 30, 2015

    this is awesome, thank you!

  9. cdtkoenig cdtkoenig December 12, 2015


    excelent hack !! 🙂
    I use autotools which work fine with watch folders (populated by sickrage and couchpotatoe) but not at all using rutorrent web GUI manual labelling.
    Is this solution compatible with autotools in order to manage manual and automatic labelling ?
    I’am afraid not …

    • krank krank March 8, 2016

      I have no idea, sorry… Haven’t used autotools myself.

  10. Ricardo Nunes Ricardo Nunes March 26, 2016


    This method still works?
    I added the two lines in .rtorrent.rc but did nothing.

    Do I have to restart the server? is necessary to change something more?

    Thank you,

    • krank krank March 26, 2016

      It should work, provided rtorrent is restarted. I’m using it myself. It’s possible there’s some version of rTorrent it doesn’t work with; I haven’t upgraded in forever…

  11. Ricardo Nunes Ricardo Nunes March 27, 2016

    I rebooted the server and it was OK.

    I still have a problem if using a label composed of 2 folders “xpto/xpto” it works but creates a folder “xpto%2Fxpto”

    Can you help?

  12. JM Gant JM Gant October 11, 2016

    this is perfect. excellent piece and a nice introduction to the blog. glad I ground this.

  13. Citrix Citrix December 28, 2019

    Out of interest did you get this working on rTorrent 0.9.8?
    It was working fine on 0.9.6 but since upgrading I have to remove this code otherwise rTorrent doesn’t start.

  14. FasterTorrents FasterTorrents July 12, 2020

    This is what worked for me for rutorrent 3.6

    directory = /defaultdownloadfolder/
    method.insert = d.finished_dir,simple,”cat=/pathtobecopiedto/,$d.custom1=”
    method.set_key =,move_complete,”$d.finished_dir=;execute=mkdir,-p,$d.finished_dir=;execute=mv,-u,$d.base_path=,$d.finished_dir=”

  15. rTorrenter rTorrenter January 21, 2021

    This is what worked for me with rTorrent 0.9.8:

    method.insert = d.get_finished_dir,simple,"cat=/path/to/finished/,$d.custom1="
    method.set_key =,move_complete,"$d.get_finished_dir=;execute=mkdir,-p,$d.get_finished_dir=;execute=mv,-u,$d.base_path=,$d.get_finished_dir="

  16. RTer RTer March 14, 2022

    Hello – I’m having a lot of trouble getting something like this working. I have about a 1000 torrents in my rtorrent 0.9.6 installation (running on unraid). I would like to create a script that allows the save path to dynamically change based on the label assigned. I tried both of the below scripts for a test file that was already downloaded and seeding, but it doesn’t seem to change the save path when I change the label. Does anyone know what I can do to get this working?

    # Add new method to get finished dir
    method.insert = d.get_finished_dir,simple,”cat=/data/,$d.get_custom1=”
    method.set_key =,move_complete,”d.set_directory=$d.get_finished_dir=;execute=mkdir,-p,$d.get_finished_dir=;execute=mv,-u,$d.get_base_path=,$d.get_finished_dir=”

    # Add new method to get finished dir
    method.insert = d.get_finished_dir,simple,”cat=/data/,$d.custom1=”
    method.set_key =,move_complete,”$d.get_finished_dir=;execute=mkdir,-p,$d.get_finished_dir=;execute=mv,-u,$d.base_path=,$d.get_finished_dir=”

  17. vdias vdias June 10, 2022

    Any update on this?

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.