0

rtorrent provides a nice script for moving downloads to a directory based on label or name
https://rtorrent-docs.readthedocs.io/en/latest/use-cases.html#versatile-move

i'm trying to configure the script using my local folder ~/files
https://github.com/rtorrent-community/rtorrent-docs/blob/master/docs/examples/completion-path.sh

It tries to use a "work" directory

# Determine target path (adapt this to your needs)
set_target_path() {
    local month=$(date +'%Y-%m')

    # Only move data downloaded into a "work" directory
    if egrep >/dev/null "/work/" <<<"${base_path}/"; then
        # Make sure the target directory is on the same drive as "work", else leave it alone
        work_dir=$(sed -re 's~(^.+/work/).*~\1~' <<<"${base_path}/")
        test $(fs4path "$work_dir") == $(fs4path "$(dirname ${base_path})") || return
    else
        return  # no "work" component in data path (pre-determined path)
    fi

i tried changing /work/ to ~/files/ but i'm not sure that's even correct syntax

# Determine target path (adapt this to your needs)
set_target_path() {
    local month=$(date +'%Y-%m')

    # Only move data downloaded into a "work" directory
    if egrep >/dev/null "~/files/" <<<"${base_path}/"; then
        # Make sure the target directory is on the same drive as "work", else leave it alone
        work_dir=$(sed -re 's~(^.+~/files/).*~\1~' <<<"${base_path}/")
        test $(fs4path "$work_dir") == $(fs4path "$(dirname ${base_path})") || return
    else
        return  # no "work" component in data path (pre-determined path)
    fi

restarted rtorrent and nothing yet

2
  • And what value does "${base_path}" contain? The egrep is checking that a "work" directory is part of ${base_path}. ~/files is a fully qualified path to the directory, not a singular directory name that the script is looking for.
    – rr0ss0rr
    Mar 16, 2023 at 15:57
  • i solved it by going back to a way older github commit and changing the line target_base=$(command cd $(dirname "$base_path")/.. >/dev/null && pwd)"/done" to target_base=$(command cd $(dirname "$base_path")/.. >/dev/null && pwd)"/files"
    – austin
    Mar 29, 2023 at 3:33

1 Answer 1

0

Based on the incomplete supplied snippet, all you need is to remove the if section and replace with:

# Determine target path (adapt this to your needs)
set_target_path() {
    local month=$(date +'%Y-%m')

    # Only move data downloaded into ~/files
    work_dir="~/files"
3
  • i linked to the full script from the source. i do like this idea of just scrapping some of the logic and getting it working straightforward. thanks
    – austin
    Mar 17, 2023 at 2:36
  • If this was a help then please accept the answer. Thanks
    – rr0ss0rr
    Mar 17, 2023 at 22:28
  • okay my script wasnt even hooked up. i didnt notice, in the completion-path.sh i failed to # Change "~/rtorrent" to your instance's directory
    – austin
    Mar 29, 2023 at 0:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .