qBittorrent can start a script of your own every time a torrent finishes, and hand it the name, the path and the category of the torrent. Use it, for example, to keep a list of finished downloads, to unpack archives or to copy files elsewhere. The steps were tested with qBittorrent 5.2.4 on our demo service.

qBittorrent basics: qBittorrent: Add and Manage Torrents in Your Browser. Connecting with SSH: SSH how to get connected.


1. Write the Script

Connect over SSH, create a folder for your scripts and open a new script in the editor nano:

mkdir -p ~/scripts
nano ~/scripts/finished.sh

This example writes one line per finished torrent into ~/scripts/finished.log:

#!/bin/sh
# qBittorrent passes: $1 = name, $2 = path of the files, $3 = category
echo "$(date "+%Y-%m-%d %H:%M:%S") finished: $1 | $2 | category: $3" >> "$HOME/scripts/finished.log"

Save with Ctrl+O and Enter and close with Ctrl+X. Then allow the script to run:

chmod +x ~/scripts/finished.sh

2. Tell qBittorrent to Run It

In qBittorrent, open the options (gear icon) and the tab Downloads, and scroll down to Run external program. Tick Run on torrent finished (1) and enter the full path of the script with its parameters (2):

/homeX/username/scripts/finished.sh "%N" "%F" "%L"

Replace /homeX/username with the path of your home folder: over SSH, echo ~/scripts/finished.sh shows the whole path of the script. qBittorrent replaces %N, %F and %L with the name, the path of the files and the category of the torrent; the list under the field (3) shows all parameters. Keep the quotes, because names often contain spaces. Scroll to the end of the options and click Save.

Options, Downloads: Run on torrent finished, the command and the parameters

3. Test It

Add a small torrent and wait until it is finished. The script then writes a line like this into finished.log:

2026-11-30 02:16:36 finished: debian-13.8.0-arm64-netinst.iso | /homeX/username/downloads/debian-13.8.0-arm64-netinst.iso | category: 

The category is empty because this torrent had none. qBittorrent also notes every run in its log (View → Log): Running external program., followed by the name of the torrent and the command exactly as it was run.


Good to Know

  • The script runs with the rights of your own account, like qBittorrent itself.
  • Run on torrent added works the same way when a torrent is added.
  • To stop the script, untick Run on torrent finished and click Save.
  • If no line appears, compare the command in the log of qBittorrent with the path of your script, and check that you ran chmod +x.
  • The same for Deluge: Deluge: Run Your Own Script When a Download Finishes.
Was this answer helpful? 0 Users Found This Useful (0 Votes)