# rtorrent: delete incomplete data only.



## rigoletto@ (Sep 3, 2017)

Hi! o/

I am using net-p2p/rtorrent with the "option" to move the completed torrents to another folder. So, the incomplete one stay in the ~/.config/rtorrent/incomplete folder, and when download finish it is moved to ~/Torrentz folder.

Sometimes I do remove a incomplete torrent from the interface but the data remains at the incomplete folder.

To delete that I am using the following line but with the downside of also deleting the data when I remove a completed one from the interface (which was moved to the ~/Torrentz folder).


```
method.set_key    = event.download.erased, remove_incomplete, "execute2=rm,-rf,--,$d.get_base_path="
```

So, I am trying to make it work deleting the data only when an incomplete torrent is removed from the interface but I am not being able to do that.

The net-p2p/rtorrent documentation sort an option but not worked for me. I found some examples around the net but all using the old syntax, and I am not managed to update to the new one (what still a weird syntax, IMHO).

I tried to find a solution at their IRC but they do insist I should use the pyrocore tools instead of the native thing, what I am not willing to do. 

This is my complete configuration as reference, any others improvements are also very welcome.


```
throttle.min_peers.normal.set       = 1
throttle.max_peers.normal.set       = 150
throttle.min_peers.seed.set       = 1
throttle.max_peers.seed.set       = 35
throttle.global_down.max_rate.set   = 0
throttle.global_up.max_rate.set       = 0

encoding.add                = UTF-8
system.umask.set            = 0022
system.cwd.set                = (directory.default)
pieces.hash.on_completion.set        = yes
protocol.pex.set            = yes
##protocol.encryption.set        = require,allow_incoming,prefer_plaintext,enable_retry
protocol.encryption.set        = allow_incoming,prefer_plaintext,enable_retry
trackers.use_udp.set            = 1
trackers.numwant.set            = 15
pieces.preload.type.set        = 2
pieces.memory.max.set            = 2048M
pieces.hash.on_completion.set        = yes

dht.port.set                = 62882
dht.mode.set                = auto
peer_exchange               = yes

network.http.ssl_verify_peer.set    = 0
network.http.dns_cache_timeout.set    = 25
network.http.max_open.set        = 25
network.max_open_files.set        = 500
network.max_open_sockets.set        = 500
network.bind_address.set       = 10.0.0.10
##network.proxy_address.set        = 10.0.0.20:3128
network.http.proxy_address.set        = 10.0.0.20:3128
network.port_range.set            = 62820-62820


method.insert = cfg.basedir, private|const|string, (cat,"/home/alex/.config/rtorrent/")
method.insert = cfg.watch,   private|const|string, (cat,(cfg.basedir),"watch/")
method.insert = cfg.logs,    private|const|string, (cat,(cfg.basedir),"log/")
method.insert = cfg.logfile, private|const|string, (cat,(cfg.logs),"rtorrent-",(system.time),".log")


execute.throw = sh, -c, (cat,\
   "builtin cd \"", (cfg.basedir), "\" ",\
   "&& mkdir -p .session incomplete log watch")


session.path.set    = (cat, (cfg.basedir), ".session/")
directory.default.set    = (cat, (cfg.basedir), "incomplete/")
log.execute        = (cat, (cfg.logs), "execute.log")
##log.xmlrpc        = (cat, (cfg.logs), "xmlrpc.log")
execute.nothrow    = bash, -c, (cat, "echo >",(session.path), "rtorrent.pid", " ", (system.pid))


method.insert = system.startup_time, value|const, (system.time)
method.insert = d.data_path, simple,\
   "if=(d.is_multi_file),\
       (cat, (d.directory), /),\
       (cat, (d.directory), /, (d.name))"
method.insert = d.session_file, simple, "cat=(session.path), (d.hash), .torrent"


schedule2    = watch_directory, 5, 5, "load.start=~/.config/rtorrent/watch/*.torrent,d.custom1.set=~/Torrentz"
method.insert    = d.get_data_full_path, simple, "branch=((d.is_multi_file)),((cat,(d.directory))), \
((cat,(d.directory),/,(d.name)))"
method.insert    = d.move_to_complete, simple, "d.directory.set=$argument.1=; \
execute2=mkdir,-p,$argument.1=; execute2=mv,$argument.0=,$argument.1=; \
d.save_full_session="
method.set_key    = event.download.finished, move_complete, \
"d.move_to_complete=$d.get_data_full_path=,$d.custom1="
method.set_key    = event.download.erased, remove_incomplete, \
"execute2=rm,-rf,--,$d.get_base_path="


schedule2 = session_save, 1200, 43200, ((session.save))
schedule2 = monitor_diskspace, 15, 60, ((close_low_diskspace, 512M))


# Adding public DHT servers for easy bootstrapping
schedule2 = dht_node_1, 5, 0, "dht.add_node=router.utorrent.com:6881"
schedule2 = dht_node_2, 5, 0, "dht.add_node=dht.transmissionbt.com:6881"
schedule2 = dht_node_3, 5, 0, "dht.add_node=router.bitcomet.com:6881"
schedule2 = dht_node_4, 5, 0, "dht.add_node=dht.aelitis.com:6881"
```

Thanks!


----------



## SirDice (Sep 8, 2017)

Not sure how rtorrent does this but with Transmission there are two ways to remove something. The first only removes the torrent, the other (remove and trash data) removes the torrent and deletes the (partially) downloaded data.


----------



## rigoletto@ (Sep 8, 2017)

net-p2p/rtorrent can do almost anything in almost any way you desire. The problem rely on how to do it.

For instance: you can have several watching folders (for different purposes), each one with different (or mixed) incomplete folder (or do not have incomplete folders at all), and still have separated custom actions for torrents originated from each separated watching folders.

Aside from its weird syntax there are the old and the "new" one. Part of the old still work in new versions, others parts not, and it is not clear what work and what not. Part of documentation were updated, other part not. Exactly same happens with examples I find around the internet.

EDIT: I just found IT.


----------

