rtorrent 提供了一个很好的脚本,用于根据标签或名称将下载内容移动到目录
https://rtorrent-docs.readthedocs.io/en/latest/use-cases.html#versatile-move
我正在尝试使用本地文件夹配置脚本~/files
https://github.com/rtorrent-community/rtorrent-docs/blob/master/docs/examples/completion-path.sh
它尝试使用“工作”目录
# 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
我尝试将 /work/ 更改为 ~/files/ 但我不确定这是否是正确的语法
# 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
重新启动 rtorrent,但什么也没有
答案1
根据提供的不完整代码片段,您所需要做的就是删除该if
部分并替换为:
# 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"