Automatically extract qBittorrent downloads

5,799

Got it to work. qBittorrent command was F:\Extractor.bat %F\*.rar %F

extractor.bat placed in root of F

Contains following script:-

timeout /t 10 /nobreak
set "arg1=%~1"
echo "%arg1%"
set "arg2=%2"
shift
shift
"C:\Program Files\WinRAR\WinRAR.exe" x "%arg1%" "%arg2%"

This successfully extracts the archive into the same directory.

Share:
5,799

Related videos on Youtube

Finchy70
Author by

Finchy70

Almost reached 50 and just completed two degrees. Computer Science (Foundation Degree) and BSc in Applied Software Engineering. I love Laravel and use Vue.js, C++ and Python. I like football, rugby, golf, and spending time with the family. Also still like my PS4, I build projects with Arduino and Raspberry pi, and enjoy gaming on my PC.

Updated on September 18, 2022

Comments

  • Finchy70
    Finchy70 over 1 year

    I want to automatically extract torrents downloaded with qBittorrent into the same directory. I have a bat F:\extrator.bat that contains.

        @ECHO off
        timeout /t 10 /nobreak
        set arg1=%1
        set arg2=%2
        shift
        shift
        "C:\Program Files\WinRAR\WinRAR.exe" x "%arg1%" "%arg2%"
    

    I call this from qBittorrent on download completion with

    "F:\extractor.bat" "%F*.rar" "%F"

    The qBittorrent log shows the args passed as arg1 = F:\Torrent\Finished\downloadname*.rar arg2 = F:\Torrent\Finished\downloadname

    However Winrar reports an error stating that C:\Windows\System32\"F:\Torrent\Finished\downloadname*.rar" could not be found.

    WinRar seems to add C:\Windows\System32\ to the beginning of arg1.

    Anyone have any ideas why this is happening?

    • wolfrevokcats
      wolfrevokcats over 6 years
      Change set arg1=%1 to set "arg1=%~1" and see what happens
    • Finchy70
      Finchy70 over 6 years
      That now pops up a window that says No Files to extract. My winrar log shows the following. -------- 28/08/2017 20:41:57, Archive F:\Torrent\Finished\The.Housing.Enforcers.S04E07.720p.HDTV.x‌​264-BARGE\the.housin‌​g.enforcers.s04e07.7‌​20p.hdtv.x264-barge.‌​rar 28/08/2017 20:41:57 No files to extract The files are in the stated location and can be unrared manually with winrar.
    • wolfrevokcats
      wolfrevokcats over 6 years
      Your winrar command line assumes that there is the file/directory The.Housing.Enforcers.S04E07.720p.HDTV.x‌​264-BARGE contained in the archive F:\Torrent\Finished\The.Housing.Enforcers.S04E07.720p.HDTV.x‌​‌​264-BARGE\the.hous‌​in‌​g.enforcers.s04e‌​07.7‌​20p.hdtv.x264-‌​barge.‌​rar. Is that so? I guess not. Probably you should omit "%arg2%" completely.
  • Adrian E. Labastida Cañizares
    Adrian E. Labastida Cañizares over 5 years
    This worked for me, but adapted it to use peazip instead and to extract in the parent folder, like this: timeout /t 10 /nobreak set "arg1=%~1" echo "%arg1%" set "arg2=%2" shift shift "C:\Program Files\PeaZip\peazip.exe" -ext2simple "%arg1%" "%arg2%\..\"