I've been using rtorrent for a while with a single directory. Now I figured out it was possible to use different directories and even to move completed downloads elsewhere, so according to the rtorrent wiki I edited my .rtorrent.rc as follow :

# Download directory
directory = /Medias/torrents/

# Watching directories
schedule = watch_directory_1,5,60,"load_start=/path/to/dl/dir1/*.torrent,d.set_custom1=/path/to/done/dir1"
schedule = watch_directory_2,5,60,"load_start=/path/to/dl/dir2/*.torrent,d.set_custom1=/path/to/done/dir2"

# On completion, move the torrent to the directory from custom1.
system.method.set_key = event.download.finished,move_complete,"d.set_directory=$d.get_custom1= ;execute=mv,-u,$d.get_base_path=,$d.get_custom1="

It seems to work for new torrents. However I have a bunch of completed files I have already downloaded before to split directories, and for them it does not work : if I delete their file in the session directory, rtorrent will check the hash but won't move them, and if I move them by myself rtorrent won't see them and will try to redownload them.

So how can I tell rtorrent either to move them or that they are in another directory ?



Ok, just figured this out. Within rtorrent you can open a command line using Ctrl+X. You can do many things from there (I guess this is basic rtorrent management), like printing things (print=$variable=, e.g. print=$d.get_directory=), executing commands (execute=command), or setting variables (variable=newvalue).

From this prompt you can move the finished torrent elsewhere, BUT note that it is neither necessary nor sufficient (see below). For instance, using the example from the .rtorrent.rc file given in the original question :


However, this command will prevent rtorrent from continuing to seed the torrent, which is why it is not sufficient. In order to continue seeding, you should, still from this command prompt, set the download directory for this torrent to the new location :


Finally, the execute command is not necessary : you can move the torrent the way you want (i.e. outside rtorrent), as long as you set the new directory as explained above.

After that it may be necessary to reopen the torrent (if it's marked as [CLOSED]) using Ctrl+R.

| improve this answer | |
  • 2
    The correct order is FIRST set the new directory, then move it, btw. And you can add a shorthand command via "method.insert", that does both of the above steps. – pyroscope Apr 11 '12 at 5:33
  • @pyroscope why is set directory first "correct"? It seems to me that you'd want to wait to see if your mv is successful before updating the directory. – g33kz0r Oct 31 '13 at 11:52
  • 2
    Nevermind, answered my own question: <Fault -503: 'Cannot change the directory of an open download atter the files have been moved.'> – g33kz0r Oct 31 '13 at 12:53

as bash script:

edit, when mv -u $old $new fails, then the whole command fails.
i ended up leaving rTorrent for qBitTorrent.

# move files in rTorrent
# with rtxmlrpc from pyrocore
# 1. select all torrents from view $view
# 2. print old d.base_path
# 3. set new d.directory
#    torrent is closed
#    d.base_path is still old d.base_path
# 4. move old files to new dir
# 5. open torrent
#    d.base_path is set to new path
# 6. save output to text file


# escape double quotes
dest=$(echo "$dest" | sed 's/"/\\"/g')

rtxmlrpc d.multicall2 '' "$view" \
  'd.base_path=' \
  "d.directory.set=\"$dest\"" \
  "execute=mv,-u,(d.base_path),\"$dest\"" \
  'd.open=' \
| tee rtxmlrpc.$(date +%s).txt
| improve this answer | |

If you're not allergic to symlinks, one way is rtmv.

| improve this answer | |
  • For this particular case I find my solution cleaner, but there are quite interesting commands in your link. Thanks. – Skippy le Grand Gourou Apr 10 '12 at 20:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.