qBittorrent can run an external program whenever a torrent finishes downloading. By connecting this feature to a PowerShell or Bash script, you can automatically extract completed RAR, ZIP and 7Z archives without touching the original torrent files.
The scripts in this guide extract each archive into a separate directory beside the archive. They leave the downloaded files unchanged, allowing qBittorrent to continue checking and seeding them normally.
This procedure covers Windows first, followed by equivalent instructions for Linux, macOS, qBittorrent-nox and Docker installations.
Reviewed and updated: 30 June 2026.
TL;DR
- Install 7-Zip.
- Create the PowerShell or Bash extraction script from this guide.
- Test the script manually against a small archive.
- Open Tools > Options > Downloads in qBittorrent.
- Scroll to the Run external program section and enable Run on torrent finished.
(Older qBittorrent releases may label this setting Run external program on torrent completion.) - Configure qBittorrent to pass
%Fto the script. - Complete a test download and check that the archive was extracted.
Key Takeaways
- qBittorrent can run an external program when a torrent finishes.
- The
%Fvariable passes the completed torrent’s content path to the script. - For a single-file torrent,
%Fnormally points to that file. - For a multi-file torrent,
%Fnormally points to the torrent’s root directory. - The scripts handle both files and directories.
- Supported formats include RAR, multipart RAR, ZIP, 7Z and split 7Z archives.
- Existing extracted files are skipped rather than overwritten.
- Original archives remain untouched so that qBittorrent can continue seeding.
- Extraction activity and errors are written to a log file.
Before You Start
You will need:
- A working qBittorrent installation.
- Permission to install 7-Zip.
- Permission to create and run a script.
- Write access to your qBittorrent download directory.
- Enough free storage for the archive and its extracted contents.
- A small legal download containing a supported archive for the final test.
Before automating post-download actions, consider binding qBittorrent to your VPN interface. Interface binding prevents qBittorrent from silently switching to your normal internet connection if the VPN disconnects.
Important Security Information
Automatic extraction saves time, but it also means files are unpacked without being reviewed first.
Follow these precautions:
- Only download and extract content that you are authorised to access.
- Keep 7-Zip and qBittorrent updated.
- Do not automatically open or run extracted executable files.
- Scan untrusted downloads with your security software.
- Be cautious with unknown archives because compressed data can consume much more disk space after extraction.
- Do not automatically delete the original archives if you intend to continue seeding.
- Avoid password-protected archives because unattended extraction cannot normally answer an interactive password prompt.
Automatically Extract qBittorrent Downloads on Windows
The Windows procedure uses Windows PowerShell and the command-line version of 7-Zip.
Step 1: Install 7-Zip
Download and install the current Windows version of 7-Zip from its official website.
Keep the default installation directory where possible. After installation, confirm that this file exists:
C:\Program Files\7-Zip\7z.exeOpen File Explorer and paste the following path into the address bar:
C:\Program Files\7-ZipYou should see 7z.exe in the directory.
If you installed 7-Zip somewhere else, you must change the $SevenZip path in the PowerShell script later in this guide.
Step 2: Create a Scripts Directory
Open File Explorer and browse to the root of the C: drive.
Create a directory named:
C:\ScriptsThe complete directory path should be:
C:\ScriptsWindows may ask for administrator approval when you create the directory.
Step 3: Create the PowerShell Extraction Script
Open Notepad and paste the following PowerShell script:
param(
[Parameter(Mandatory = $true, Position = 0)]
[ValidateNotNullOrEmpty()]
[string]$ContentPath
)
$ErrorActionPreference = "Stop"
# Change this path if 7-Zip is installed somewhere else.
$SevenZip = "C:\Program Files\7-Zip\7z.exe"
# Store the extraction log under the current user's local application data.
$LogDirectory = Join-Path $env:LOCALAPPDATA "qBittorrent"
$LogFile = Join-Path $LogDirectory "extract.log"
New-Item `
-ItemType Directory `
-Path $LogDirectory `
-Force | Out-Null
function Write-Log {
param(
[Parameter(Mandatory = $true)]
[string]$Message
)
$Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
Add-Content `
-LiteralPath $LogFile `
-Value "$Timestamp - $Message"
}
function Test-PrimaryArchive {
param(
[Parameter(Mandatory = $true)]
[System.IO.FileInfo]$File
)
$Name = $File.Name.ToLowerInvariant()
# Process only the first file in a multipart RAR archive.
# This accepts names such as part1.rar, part01.rar and part001.rar.
if ($Name -match '\.part\d+\.rar$') {
return ($Name -match '\.part0*1\.rar$')
}
return (
$Name -match '\.(rar|zip|7z)$' -or
$Name -match '\.7z\.001$'
)
}
function Get-ExtractionFolderName {
param(
[Parameter(Mandatory = $true)]
[System.IO.FileInfo]$Archive
)
$FolderName = $Archive.Name
$FolderName = $FolderName -replace '(?i)\.part0*1\.rar$', ''
$FolderName = $FolderName -replace '(?i)\.7z\.001$', ''
$FolderName = $FolderName -replace '(?i)\.(rar|zip|7z)$', ''
return $FolderName
}
Write-Log "Processing completed torrent path: $ContentPath"
if (-not (Test-Path -LiteralPath $SevenZip -PathType Leaf)) {
Write-Log "ERROR: 7-Zip was not found at $SevenZip"
exit 1
}
if (-not (Test-Path -LiteralPath $ContentPath)) {
Write-Log "ERROR: The completed torrent path does not exist: $ContentPath"
exit 1
}
try {
$ContentItem = Get-Item -LiteralPath $ContentPath
if ($ContentItem.PSIsContainer) {
$Files = Get-ChildItem `
-LiteralPath $ContentPath `
-File `
-Recurse `
-ErrorAction SilentlyContinue
}
else {
$Files = @($ContentItem)
}
$Archives = @(
$Files | Where-Object {
Test-PrimaryArchive -File $_
}
)
if ($Archives.Count -eq 0) {
Write-Log "No supported archives were found."
exit 0
}
$FailedExtractions = 0
foreach ($Archive in $Archives) {
$FolderName = Get-ExtractionFolderName -Archive $Archive
$Destination = Join-Path $Archive.DirectoryName $FolderName
[System.IO.Directory]::CreateDirectory($Destination) | Out-Null
Write-Log "Extracting $($Archive.FullName) to $Destination"
$SevenZipOutput = & $SevenZip `
x `
$Archive.FullName `
"-o$Destination" `
-y `
-aos 2>&1
$ExitCode = $LASTEXITCODE
foreach ($Line in @($SevenZipOutput)) {
if ($null -ne $Line) {
Write-Log "7-Zip: $Line"
}
}
if ($ExitCode -eq 0) {
Write-Log "Extraction completed successfully: $($Archive.Name)"
}
else {
$FailedExtractions++
Write-Log "ERROR: 7-Zip returned exit code $ExitCode for $($Archive.FullName)"
}
}
if ($FailedExtractions -gt 0) {
Write-Log "Completed with $FailedExtractions extraction error or errors."
exit 1
}
Write-Log "All supported archives were processed successfully."
exit 0
}
catch {
Write-Log "ERROR: $($_.Exception.Message)"
exit 1
}Select File > Save As.
Browse to:
C:\ScriptsEnter the following filename:
qbittorrent-extract.ps1Change Save as type to All Files and select UTF-8 as the encoding.
Save the file.
The complete path should now be:
C:\Scripts\qbittorrent-extract.ps1Make sure Notepad has not added .txt to the filename. The file must not be called:
qbittorrent-extract.ps1.txtTo display file extensions in Windows 11, open File Explorer and select:
View > Show > File name extensionsStep 4: Create a Test ZIP Archive
Test the script before connecting it to qBittorrent.
Open PowerShell and run:
New-Item -ItemType Directory -Path "C:\Downloads\TestSource" -Force
Set-Content -Path "C:\Downloads\TestSource\TestFile.txt" -Value "qBittorrent extraction test"
Compress-Archive `
-Path "C:\Downloads\TestSource\TestFile.txt" `
-DestinationPath "C:\Downloads\TestArchive.zip" `
-ForceYou should now have this file:
C:\Downloads\TestArchive.zipStep 5: Test the PowerShell Script Manually
Run:
powershell.exe `
-NoProfile `
-ExecutionPolicy Bypass `
-File "C:\Scripts\qbittorrent-extract.ps1" `
"C:\Downloads\TestArchive.zip"The script should create:
C:\Downloads\TestArchiveOpen that directory and confirm that it contains:
TestFile.txtThe original archive should remain in place:
C:\Downloads\TestArchive.zipCheck the log by entering the following path into File Explorer:
%LOCALAPPDATA%\qBittorrent\extract.logThe log should contain entries similar to:
2026-06-30 12:00:00 - Processing completed torrent path: C:\Downloads\TestArchive.zip
2026-06-30 12:00:00 - Extracting C:\Downloads\TestArchive.zip to C:\Downloads\TestArchive
2026-06-30 12:00:01 - Extraction completed successfully: TestArchive.zip
2026-06-30 12:00:01 - All supported archives were processed successfully.Do not continue until the manual test succeeds.
Step 6: Configure qBittorrent
Open qBittorrent and select:
Tools > OptionsSelect Downloads in the left-hand menu.
Scroll to the bottom of the Downloads settings and enable:
Run external program on torrent completionPaste the following command into the program field:
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "C:\Scripts\qbittorrent-extract.ps1" "%F"Keep the quotation marks around the script path and %F. They prevent spaces in file and directory names from breaking the command.
Select Apply, followed by OK.
What %F Means
%F is the qBittorrent variable for the torrent content path.
For a single-file torrent, it can contain a path such as:
D:\Downloads\ExampleArchive.zipFor a multi-file torrent, it can contain the torrent’s root directory:
D:\Downloads\ExampleDownloadThe script checks whether the supplied path is a file or a directory. When it receives a directory, it searches that directory recursively for supported archives.
Step 7: Restart qBittorrent
qBittorrent does not normally require a restart after this setting is applied. Restart it only as a troubleshooting step if the external program does not run.
However, for completeness you may wish to restart it. Check the Windows notification area to make sure qBittorrent is not still running in the background. Right-click its icon and select Exit where necessary.
Reopen qBittorrent and confirm that the external program setting remains enabled.
Step 8: Test Automatic Extraction
Add a small torrent that you are authorised to download and that contains a ZIP, RAR or 7Z archive.
Wait for the torrent to reach 100%.
Open the torrent’s download directory and confirm that:
- A new extraction directory has appeared beside the archive.
- The extracted directory contains the expected files.
- The original archive remains in place.
- qBittorrent can continue seeding the original torrent.
- The extraction log contains a successful completion entry.
How the Windows Script Works
The Windows script performs the following operations:
- Receives the completed torrent path through
%F. - Confirms that 7-Zip exists.
- Confirms that the completed torrent path exists.
- Determines whether the path is a file or directory.
- Searches directories recursively.
- Identifies supported archive files.
- Ignores later parts of multipart RAR archives.
- Creates a destination directory beside each archive.
- Runs 7-Zip in extraction mode.
- Skips files that already exist.
- Records the result in a log.
- Leaves the original archive unchanged.
The script recognises:
Example.rar
Example.part1.rar
Example.part01.rar
Example.part001.rar
Example.zip
Example.7z
Example.7z.001For a multipart RAR archive, extraction starts from the first part. All remaining parts must be present in the same directory.
Automatically Extract qBittorrent Downloads on Linux and macOS
The Linux and macOS procedure uses a Bash script. It looks for the 7zz, 7z or 7za command automatically.
Step 1: Install 7-Zip on Ubuntu or Debian
Update the package list:
sudo apt updateInstall 7-Zip:
sudo apt install 7zipSome Linux distributions separate RAR support into another package. On supported Ubuntu versions, you can install the RAR plugin with:
sudo apt install 7zip-rarThe 7zip-rar package may require an additional repository and may not be available on every Debian-based distribution. Install it only when the standard 7zip package cannot extract your RAR test archive.
Verify the installation:
command -v 7zz || command -v 7z || command -v 7zaThe command should return a path such as:
/usr/bin/7zzStep 2: Install 7-Zip on macOS
Install Homebrew first if it is not already available.
Install 7-Zip with:
brew install sevenzipVerify the installation:
command -v 7zz || command -v 7z || command -v 7zaHomebrew will normally make the command available through its installation prefix.
Step 3: Create a Scripts Directory
Create a scripts directory in your home directory:
mkdir -p "$HOME/scripts"Step 4: Create the Bash Extraction Script
Open a new script in Nano:
nano "$HOME/scripts/qbittorrent-extract.sh"Paste the following script:
#!/usr/bin/env bash
set -u
content_path="${1:-}"
state_directory="${XDG_STATE_HOME:-$HOME/.local/state}"
log_directory="$state_directory/qbittorrent"
log_file="$log_directory/extract.log"
if ! mkdir -p "$log_directory"; then
printf 'Unable to create log directory: %s\n' "$log_directory" >&2
exit 1
fi
log_message() {
printf '%s - %s\n' \
"$(date '+%Y-%m-%d %H:%M:%S')" \
"$1" >> "$log_file"
}
find_sevenzip() {
local command_name
for command_name in 7zz 7z 7za; do
if command -v "$command_name" >/dev/null 2>&1; then
command -v "$command_name"
return 0
fi
done
return 1
}
is_primary_archive() {
local filename="$1"
local lowercase_name
lowercase_name="$(printf '%s' "$filename" | tr '[:upper:]' '[:lower:]')"
if [[ "$lowercase_name" =~ \.part[0-9]+\.rar$ ]]; then
[[ "$lowercase_name" =~ \.part0*1\.rar$ ]]
return
fi
[[ "$lowercase_name" =~ \.(rar|zip|7z)$ ]] ||
[[ "$lowercase_name" =~ \.7z\.001$ ]]
}
get_folder_name() {
local filename="$1"
local folder_name="$filename"
shopt -s nocasematch
if [[ "$filename" =~ ^(.*)\.part0*1\.rar$ ]]; then
folder_name="${BASH_REMATCH[1]}"
elif [[ "$filename" =~ ^(.*)\.7z\.001$ ]]; then
folder_name="${BASH_REMATCH[1]}"
elif [[ "$filename" =~ ^(.*)\.(rar|zip|7z)$ ]]; then
folder_name="${BASH_REMATCH[1]}"
fi
shopt -u nocasematch
printf '%s' "$folder_name"
}
process_archive() {
local archive="$1"
local filename
local parent_directory
local folder_name
local destination
filename="$(basename "$archive")"
if ! is_primary_archive "$filename"; then
return 0
fi
parent_directory="$(dirname "$archive")"
folder_name="$(get_folder_name "$filename")"
destination="$parent_directory/$folder_name"
mkdir -p "$destination"
log_message "Extracting $archive to $destination"
if "$sevenzip" \
x \
"$archive" \
"-o$destination" \
-y \
-aos >> "$log_file" 2>&1; then
log_message "Extraction completed successfully: $archive"
else
log_message "ERROR: Extraction failed: $archive"
return 1
fi
}
if [[ -z "$content_path" ]]; then
log_message "ERROR: No completed torrent path was supplied."
exit 1
fi
if [[ ! -e "$content_path" ]]; then
log_message "ERROR: Path does not exist: $content_path"
exit 1
fi
if ! sevenzip="$(find_sevenzip)"; then
log_message "ERROR: Could not find 7zz, 7z or 7za."
exit 1
fi
log_message "Processing completed torrent path: $content_path"
found_archive=0
failed_archive=0
if [[ -d "$content_path" ]]; then
archive_list="$(mktemp)"
trap 'rm -f "$archive_list"' EXIT
find "$content_path" \
-type f \
\( \
-iname '*.rar' \
-o -iname '*.zip' \
-o -iname '*.7z' \
-o -iname '*.7z.001' \
\) \
-print0 > "$archive_list"
while IFS= read -r -d '' archive; do
if is_primary_archive "$(basename "$archive")"; then
found_archive=$((found_archive + 1))
if ! process_archive "$archive"; then
failed_archive=$((failed_archive + 1))
fi
fi
done < "$archive_list"
else
if is_primary_archive "$(basename "$content_path")"; then
found_archive=1
if ! process_archive "$content_path"; then
failed_archive=1
fi
fi
fi
if [[ "$found_archive" -eq 0 ]]; then
log_message "No supported archives were found."
exit 0
fi
if [[ "$failed_archive" -gt 0 ]]; then
log_message "Completed with $failed_archive extraction error or errors."
exit 1
fi
log_message "All supported archives were processed successfully."
exit 0Save the file in Nano:
- Press
Ctrl+O. - Press
Enter. - Press
Ctrl+X.
Step 5: Make the Script Executable
Run:
chmod 755 "$HOME/scripts/qbittorrent-extract.sh"Confirm the permissions:
ls -l "$HOME/scripts/qbittorrent-extract.sh"The output should show executable permissions similar to:
-rwxr-xr-xStep 6: Test the Bash Script Manually
Run the script against a test archive:
"$HOME/scripts/qbittorrent-extract.sh" "$HOME/Downloads/TestArchive.zip"Replace the archive path with the location of your test file.
Confirm that a new directory appears beside the archive and contains the extracted files.
Check the log:
cat "${XDG_STATE_HOME:-$HOME/.local/state}/qbittorrent/extract.log"Do not connect the script to qBittorrent until this test works.
Step 7: Configure qBittorrent on Linux
Open qBittorrent and select:
Tools > Options > DownloadsEnable:
Run external program on torrent completionEnter the following command, replacing USERNAME with your Linux username:
/bin/bash "/home/USERNAME/scripts/qbittorrent-extract.sh" "%F"For example:
/bin/bash "/home/richard/scripts/qbittorrent-extract.sh" "%F"Select Apply, followed by OK.
Restart qBittorrent before running the final test.
Step 8: Configure qBittorrent on macOS
Open qBittorrent and select:
qBittorrent > Preferences > DownloadsEnable:
Run external program on torrent completionEnter the command using your macOS username:
/bin/bash "/Users/USERNAME/scripts/qbittorrent-extract.sh" "%F"For example:
/bin/bash "/Users/richard/scripts/qbittorrent-extract.sh" "%F"Apply the change and restart qBittorrent.
Running the Script with qBittorrent-nox
When qBittorrent runs as a background service, the service account executes the extraction script. That account must have access to the script, archive, extraction directory and 7-Zip binary.
Identify the account running qBittorrent:
ps aux | grep '[q]bittorrent'Check the download directory permissions:
ls -ld "/path/to/downloads"Check the script:
ls -l "/home/USERNAME/scripts/qbittorrent-extract.sh"Check the 7-Zip command:
command -v 7zz || command -v 7z || command -v 7zaTest the script as the service account:
sudo -u qbittorrent \
/bin/bash \
"/home/USERNAME/scripts/qbittorrent-extract.sh" \
"/path/to/TestArchive.zip"Replace:
qbittorrentwith the actual service account.USERNAMEwith the account that owns the script./path/to/TestArchive.zipwith a valid test archive.
A service account may be unable to access a script stored inside another user’s home directory. In that situation, place the script in a shared location such as:
/usr/local/bin/qbittorrent-extract.shSet the ownership and permissions appropriately:
sudo chown root:root /usr/local/bin/qbittorrent-extract.sh
sudo chmod 755 /usr/local/bin/qbittorrent-extract.shThen configure qBittorrent to run:
/bin/bash "/usr/local/bin/qbittorrent-extract.sh" "%F"Expected Extraction Result
Consider a torrent containing this multipart archive:
Downloads/
└── ExampleDownload/
├── ExampleDownload.part01.rar
├── ExampleDownload.part02.rar
└── ExampleDownload.part03.rarAfter successful extraction, the directory should look like:
Downloads/
└── ExampleDownload/
├── ExampleDownload/
│ └── ExtractedFile.ext
├── ExampleDownload.part01.rar
├── ExampleDownload.part02.rar
└── ExampleDownload.part03.rarThe script starts extraction from ExampleDownload.part01.rar. 7-Zip reads the remaining parts automatically.
The original RAR files stay in place.
Troubleshooting Automatic qBittorrent Extraction
Nothing Happens When the Torrent Completes
Open:
Open View > Log > Show, then select the Execution Log tab.Look for an entry showing that qBittorrent attempted to run the external program.
Then check:
- Run external program on torrent completion is enabled.
- The command contains
%F. %Fis enclosed in quotation marks.- The script path is correct.
- The script works when run manually.
- 7-Zip is installed.
- qBittorrent was restarted after the setting changed.
The external program does not run through a normal interactive terminal. Shell-only features such as output redirection, pipes and command chaining may not behave as expected when entered directly in the qBittorrent field. Put the required logic inside the PowerShell or Bash script instead.
Windows Cannot Find the PowerShell Script
Confirm that this file exists:
C:\Scripts\qbittorrent-extract.ps1Enable file extensions in File Explorer and make sure the file is not named:
qbittorrent-extract.ps1.txtRetest it manually:
powershell.exe `
-NoProfile `
-ExecutionPolicy Bypass `
-File "C:\Scripts\qbittorrent-extract.ps1" `
"C:\Downloads\TestArchive.zip"7-Zip Cannot Be Found on Windows
Check:
C:\Program Files\7-Zip\7z.exeIf 7-Zip is installed elsewhere, edit this line in the PowerShell script:
$SevenZip = "C:\Program Files\7-Zip\7z.exe"Replace it with the correct path.
7-Zip Cannot Be Found on Linux or macOS
Run:
command -v 7zz
command -v 7z
command -v 7zaThe script needs at least one of these commands.
On Ubuntu or Debian, reinstall the package:
sudo apt update
sudo apt install 7zipOn macOS:
brew reinstall sevenzipRAR Extraction Fails on Linux
Start by testing the archive manually:
7zz x "/path/to/Example.rar" -o"/tmp/rar-test"Replace 7zz with 7z or 7za when necessary.
If the command reports missing RAR support, install the appropriate RAR plugin supplied by your distribution. On supported Ubuntu versions:
sudo apt install 7zip-rarAlso confirm that every part of the multipart archive is present.
For example:
Example.part01.rar
Example.part02.rar
Example.part03.rarExtraction will fail when one of the required parts is missing or incomplete.
Permission Denied on Linux
Confirm that the script is executable:
chmod 755 "$HOME/scripts/qbittorrent-extract.sh"Check the download directory:
ls -ld "/path/to/downloads"Check the archive:
ls -l "/path/to/downloads/Example.zip"The account running qBittorrent needs permission to:
- Read the archive.
- Execute the script.
- Run 7-Zip.
- Create the destination directory.
- Write the extracted files.
- Write to the log directory.
The Archive Is Password-Protected
The scripts do not provide an archive password.
Password-protected archives may fail or wait for input that qBittorrent cannot supply.
Do not place passwords directly in the qBittorrent external program command. The command may appear in configuration files, process information or logs.
Extract password-protected archives manually.
Files Are Extracted More Than Once
The scripts use the 7-Zip -aos option, which skips files that already exist.
Repeated completion events may still cause the script to inspect and process the same archive again. Review the log to determine whether qBittorrent started the script more than once.
On Windows:
%LOCALAPPDATA%\qBittorrent\extract.logOn Linux or macOS:
cat "${XDG_STATE_HOME:-$HOME/.local/state}/qbittorrent/extract.log"Also check that the same script is not configured in another download automation tool.
No Supported Archive Was Found
The scripts recognise:
.rar
.part01.rar
.zip
.7z
.7z.001Check that the archive exists inside the path supplied through %F.
The log records the exact content path received from qBittorrent:
Processing completed torrent path: ...Use that entry to confirm that qBittorrent and the script are looking at the same directory.
The Destination Directory Is Empty
An empty extraction directory usually means 7-Zip started but could not complete the extraction.
Check the log for:
- CRC errors.
- Missing multipart archive files.
- Unsupported archive formats.
- Password requests.
- Permission errors.
- Insufficient disk space.
- A damaged archive.
Test the archive directly with 7-Zip to separate an archive problem from a qBittorrent configuration problem.
qBittorrent Is Running in Docker
The external program runs inside the qBittorrent container, not directly on the Docker host.
You must therefore:
- Install or include 7-Zip inside the container.
- Make the script available inside the container.
- Store the script in a persistent mounted directory.
- Use container paths in the qBittorrent command.
- Give the container user write access to the download volume.
- Reinstall additional packages whenever the container is recreated unless you use a custom image.
A host path such as:
/mnt/storage/downloadsmight appear inside the container as:
/downloadsThe script must receive the container path because that is the filesystem visible to qBittorrent.
For example:
/bin/bash "/config/scripts/qbittorrent-extract.sh" "%F"Test the script inside the running container:
docker exec -it qbittorrent \
/bin/bash \
"/config/scripts/qbittorrent-extract.sh" \
"/downloads/TestArchive.zip"Replace the container name and paths with those used by your installation.
Frequently Asked Questions
Will This Delete the Original Archive?
No.
The scripts do not delete, rename or modify the downloaded archive. This allows qBittorrent to continue checking and seeding the original files.
Will the Script Run for Every Completed Torrent?
Yes.
qBittorrent starts the configured external program whenever a torrent completes. The script checks the supplied content path and exits without making changes when it cannot find a supported archive.
Where Are Extracted Files Stored?
Each archive is extracted into a directory beside the archive.
For example:
Downloads/
├── Example.zip
└── Example/
└── ExtractedFile.txtDoes It Support Multipart RAR Archives?
Yes.
The script recognises first-part filenames such as:
Example.part1.rar
Example.part01.rar
Example.part001.rarIt ignores later .part02.rar, .part03.rar and similar files because 7-Zip reads those parts after opening the first archive.
Traditional multipart sets that begin with Example.rar and continue with Example.r00 may also work because the script starts extraction from the main .rar file.
Does It Support Split 7Z Archives?
Yes.
The script starts extraction from:
Example.7z.001The remaining files must use the expected sequence:
Example.7z.002
Example.7z.003All parts must be available in the same directory.
Does It Extract Nested Archives?
The script processes archive files that exist when the torrent completion event starts.
It does not repeatedly scan newly extracted content. An archive contained inside another archive will remain untouched unless it was already visible in the original torrent directory.
This prevents an unexpected chain of recursive extractions.
Can I Extract Everything into One Central Directory?
Yes, but you would need to change the $Destination variable in PowerShell or the destination variable in Bash.
Separate extraction directories are safer because archives from different torrents cannot silently overwrite or combine their contents.
Can I Automatically Delete Archives After Extraction?
It is technically possible, but I do not recommend it.
Deleting or changing torrent data prevents qBittorrent from verifying and seeding the original files. Keep the archives until the torrent reaches your preferred sharing ratio and you no longer need to seed it.
Why Does the Script Skip Existing Files?
The -aos option tells 7-Zip to skip files that already exist.
This protects files from being overwritten when qBittorrent triggers another completion event or when the script is run manually more than once.
Where Are Extraction Errors Recorded?
On Windows:
%LOCALAPPDATA%\qBittorrent\extract.log
On Linux and macOS:
${XDG_STATE_HOME:-$HOME/.local/state}/qbittorrent/extract.log
The logs include the path received from qBittorrent, the archive being processed, 7-Zip output and the final result.
Source Check – 30 June 2026
- Checked the qBittorrent external-program-on-completion option.
- Confirmed that
%Frepresents the torrent content path. - Confirmed the different content-path behaviour for single-file and multi-file torrents.
- Checked the current official 7-Zip Windows, Linux and macOS releases.
- Checked the current Ubuntu
7zipand optional7zip-rarpackages. - Checked the current Homebrew
sevenzipinstallation command. - Tested the Bash script syntax and archive-selection logic with directories containing spaces, multipart RAR files, ZIP files and split 7Z files.
Conclusion
qBittorrent’s external program feature provides a reliable way to automate archive extraction without changing the original torrent data.
The most important step is the manual script test. Confirm that the script can find 7-Zip, extract a local archive and write to its log before connecting it to qBittorrent. Once that works, qBittorrent only needs to pass the completed content path through %F.
Keep the original archives while you are seeding, review the extraction log when something fails and never automatically execute files after they have been unpacked


Leave a Reply