3

Suppose you use the transmission-gtk BitTorrent client (v2.94) on a Linux system to seed some files, e.g. Linux distribution ISOs and LibreOffice versions. Suppose that the basic "Save To Location" is: /path1/torrents and the incomplete torrents path is /path1/torrents/incomplete.

Now suppose that you shut down transmission-gtk, and rename /path1 to /path2 (and do not symlink the old path to the new one).

It is simple to change the location for future torrents using the app's configuration dialog, or in $HOME/.config/transmission. However, when one does this, all previously-active torrents are now marked red, with data supposedly missing.

What should one do to correct the locations for existing torrents (complete and incomplete)? And - can this be automated somehow so that it could be done from the command line (e.g. on files in $HOME/.config/transmission/resume)?

einpoklum
  • 10,666

2 Answers2

3

Right-click the torrent, click "Set Location" and select the new parent directory (/path2/torrents in this case). You can do this for all torrents at once, if they all were moved to the same directory.

After updating the location, right-click again and select "Verify local data" to let Transmission recheck which files/parts have been already downloaded.


This is automatable from CLI – but first enable the "web UI" feature in Transmission, which also allows you to use transmission-remote.

For each torrent, run transmission-remote --find with the new parent directory.


The files in ~/.config/transmission/resume/ are in the same "Bencode" format as .torrent files themselves, and they could probably be modified using e.g. Perl's Convert::Bencode or very careful sed'ing, but I'm not sure if I would recommend that method.

You'd want to update the "destination" item in the top-level dict:

$ bencode2json < 16a3968b347a81845384394e7f1b38656aeee97a.resume | head
{
    "activity-date": "1619012434",
    "added-date": "1619011497",
    "bandwidth-priority": "0",
    "corrupt": "0",
    "destination": "/home/xxx/Downloads",
    "dnd": [
    ...

(If you go with direct binary editing, note that Bencoded strings are prefixed with their length which needs to be updated as well, e.g. 19:/home/xxx/Downloads in this case.)

grawity
  • 501,077
2

An addition to @user1686's great answer: You can update the location of all torrents at once:

  • Select "All" and "All" in the to "Show:" bar (so that all torrents are visible).
  • Press Ctrl+A to select all visible torrents.
  • Right-click any of the selected torrents.
  • Select "Set Location".
  • Choose "Other".
  • Navigate to the new folder for torrents (in your case "/path2/torrents").
  • Select "Local data is already there".
  • Click "Apply".
  • Wait a while for the torrents to be updated.
  • When the dialog has disappeared, restart transmission-gtk.

Your torrents should all be recognized as resumeable. You still have to actually resume them though - they're auto-paused if the data couldn't be found.

einpoklum
  • 10,666