rakshasa / rtorrent

rTorrent BitTorrent client
https://github.com/rakshasa/rtorrent/wiki
GNU General Public License v2.0
4.05k stars 412 forks source link

Copy files on completion #1113

Closed phibster closed 2 years ago

phibster commented 2 years ago

Hopefully someone has come across this before. I am running 0.9.8 and have a download directory and an extract directory. What I would like to happen is when a torrent completes its data gets copied to the extract directory where I can then pull the data into my server, thus deleting the extract copy but leaving the original download to keep seeding.

I had this working once before but my server crashed and I lost all my config files and google is only finding ways to move the data not copy it.

As an added bonus I have a watch directory where torrent files are placed, and I originally had it moving the .torrent file into a subdirectory called imported so that I knew it had loaded without even opening an interface.

Any help appreciated :)

pyroscope commented 2 years ago

Is replacing mv -u by cp -rpl that unobvious?

phibster commented 2 years ago

Apparently it was, I had modified one of the move commands but must have messed up somewhere else. Retried again and got it all working. For reference I have put the relevant config below in case anyone comes across this and needs. Thanks for the prompt on looking in the right direction pryo.

moves .torrent to imported folder after loaded into rtorrent

method.set_key = event.download.inserted_new, move_torrent, "execute={mv,--,\"$cat=$d.tied_to_file=\",/watch/imported/}"

copy files from /downloads/ folder to /ssd/ extract folder when complete leaving original in place

method.insert = d.get_finished_dir, simple, "cat=/downloads/,$d.custom1=" method.insert = d.data_path, simple, "if=(d.is_multi_file), (cat,(d.directory),/), (cat,(d.directory),/,(d.name))" method.insert = d.copy_to_ssd, simple, "execute=cp,-rp,$argument.0=,$argument.1=;" method.set_key = event.download.finished,move_complete,"d.copy_to_ssd=$d.data_path=,/ssd/"