Moving Files
Moving Files
After completion of a download, I moved the receiving folder to a new location, which prevented seeding. I believe this is because Transmission does not know the new location. How do I inform Transmission of the new location?
Re: Moving Files
Best option: move the file(s) using Transmission.
2nd best: tell Transmission the change of location. Don't expect 100% success rate, Transmission may detect the error before you tell about the change.
Of course this depends on the actual client you are using, but since you're not posting on the Mac OSX section, or the GTK section, then you must be using the daemon, or something else (and the Mac/GTK/Qt clients have the option on their context menu, and torrent menu in "Set Location...").
Code: Select all
transmission-remote -t <torrent-id or hash-code> --move <destination path>
Code: Select all
transmission-remote -t <torrent-id or hash-code> --find <location of files>
Re: Moving Files
I would suggest that the "2nd best method" listed above really be
the 1st best method, since it doesn't actually move any files and just tells transmission where to start using the files from, in place.
I run 2 copies of transmission to provide better priority control and rpc response time, so on some regular basis I move torrents from one copy of transmission to the other -- but I don't need to change the physical location of the files..
I wrote a simple 'quick & dirty' script to do the move for me.
that assumes I am moving from my main transmission instance to
a child. It takes the name of the "torrent" file listed under the
source torrent's ".torrent" file list and uses the info found there to move it to the 2nd torrent server. If the move is successful, it removes the torrent from the first server (on failure it doesn't remove it).
It could be made more elaborate to support more children or bidirectional movement... other, less "low-level" ways of selecting the torrent (specifying the actual torrent file was the easiest way to support an unambiguous addressing since torrents can have the same name).
-I'll include it below as an example- (works for me, but
that doesn't mean it is bug free! )
-------------------------------- movetor:
the 1st best method, since it doesn't actually move any files and just tells transmission where to start using the files from, in place.
I run 2 copies of transmission to provide better priority control and rpc response time, so on some regular basis I move torrents from one copy of transmission to the other -- but I don't need to change the physical location of the files..
I wrote a simple 'quick & dirty' script to do the move for me.
that assumes I am moving from my main transmission instance to
a child. It takes the name of the "torrent" file listed under the
source torrent's ".torrent" file list and uses the info found there to move it to the 2nd torrent server. If the move is successful, it removes the torrent from the first server (on failure it doesn't remove it).
It could be made more elaborate to support more children or bidirectional movement... other, less "low-level" ways of selecting the torrent (specifying the actual torrent file was the easiest way to support an unambiguous addressing since torrents can have the same name).
-I'll include it below as an example- (works for me, but
that doesn't mean it is bug free! )
-------------------------------- movetor:
Code: Select all
#!/bin/bash
# movetor:
# Torrent-name, [new-tracker [oldtracker [ datalocation]]]
# Default: torrent-name -- check what tracker it is on
# get data-loc, move to [child1]
if [[ $# == 0 ]] ;then
echo "Torrent name, data-location, new-tracker, oldtracker"
echo " Default: torrent-name -- check what tracker it is on"
echo " get data-loc, move to [child1]"
exit 0
fi
trm_home=/home/transmission
#NOTE: children copies of transmission are currently located under
the same directory, but in subdirs under it:
/home/transmission/child1
/home/transmission/child2 and so on.
sudo chmod -R g+rwX,o+rX $trm_home
shopt -s extglob expand_aliases
alias array='declare -a' sub=function int='declare -i' string=declare
alias my=declare
string path="$1" from="" Trmf=trm
int to_id=1
string to="child$to_id" Trmt=trm$to_id
# for now, only searching to move from main-tor to aan alternate child
if [[ ! $path =~ ^.*transmission/torrents.*$ ]]; then
echo "not yet supported" >&2
exit 1
fi
file="${path##*/}"
name=${file%%.*.torrent}
if [[ ${name:-} == "" ]] || [[ $name == $file ]]; then
echo "Getting name from tor failed" >&2
exit 2
fi
printf -v qname "%q" "$name"
printf -v qfile "%q" "$file"
sub get_tor_id () {
local qname="$1" TRM="$2"
array mytors
readarray -t mytors < <($Trmf -l|fgrep "$name")
if [[ ${#mytors[@]} -ne 1 ]]; then
printf "Error: found 0 or more than one match(%d)\n " ${mytors[@]} >&2
exit 3
fi
local mytorln="${mytors[0]}" mytorid rest
read mytorid rest <<<(echo $mytorln)
echo "$mytorid"
}
sub get_tor_location() {
local qfile=$1 Trm=$2
local mytorid=$(get_tor_id "$qname" "$Trm")
if [[ -z $mytorid ]]; then echo "no torid found" >&2; fi
loc=$($Trmf -t $mytorid -i|grep "Location:"|sed 's/^ *Location: //' )
loc=${loc#Location: }
files=$(echo "$loc/$name."* )
if [[ -d $loc/$name|| -f $files ]]; then
echo "$loc"; return 0
fi
echo "Error: Data not found: $loc/$name"; >&2
exit 3
}
loc="$(get_tor_location "$qname" "$Trmf")"
$Trmt -a "$path" --find "$loc" || {
echo "problem submitting tor?" >&2
exit 4
}
loc2=$(get_tor_location "$qname" "$Trmt")
if [[ $loc == $loc2 ]] ; then
t_torid=$(get_tor_id "$qname" "$Trmt")
$Trmt -t "$t_torid" -s || {
echo "Problem starting tor on new server"
exit 6
}
f_torid=$(get_tor_id "$qname" "$Trmf")
if [[ $f_torid =~ ^[0-9]+$ ]]; then
echo Removing old... >&2
$Trmf -t "$f_torid" --remove || {
echo "Problem removing tor" >&2
exit 5
}
fi
echo Move complete! >&2
fi