I am trying to write a script (.bat) that removes torrents from the Transmission Windows app (not the daemon) once they are completed.
Here is the code I am using:
Code: Select all
@echo off
set tr_dir="C:\TransmissionScripts"
set tr_app="C:\Program Files\Transmission\transmission-remote.exe"
set host="localhost"
set port="PORT"
set user="USER"
set passwd="PASSWORD"
cd %tr_dir%
%tr_app% %host%:%port% --auth %user%:%passwd% --list | find "100%" > completed-torrents.txt
for /f "tokens=1 delims= " %%a in (completed-torrents.txt) do (
%tr_app% %host%:%port% --auth %user%:%passwd% --torrent %%a --remove
)
del completed-torrents.txt
When I open the generated txt file, it contains the expected line(s) with the torrent IDs, names etc...
However it never enters the FOR loop and the command to remove the torrents is not executed.
Can you please help me understand what is wrong with this script ?
Many thanks in advance for your help.