-1

I want to do this on Linux with rar x filename.

The RAR archive file is split into parts, for example:

Filename-001.rar
Filename-002.rar
Filename-003.rar

I wanted to extract them all at once with a Python script.

Mofi
  • 46,139
  • 17
  • 80
  • 143
  • `WinRAR.exe` and `Rar.exe` are __shareware__. So the users of your Python script would need to purchase a license to use the two executables. `UnRAR.exe` is freeware like `UnRAR.dll`. The source code to extract RAR archives is even open source, see [WinRAR and RAR archiver addons](https://www.rarlab.com/rar_add.htm). A multi-volume RAR archive is extracted automatically completely on using `UnRAR.exe` with command `e` or `x` on first volume `Filename-001.rar`. – Mofi Feb 27 '22 at 17:59
  • `UnRAR.exe` automatically finds out on Windows that `Filename-001.rar` is just the first volume of a multi-volume archive on running `UnRAR.exe x Filename-001.rar` and extracts all files and directories in multi-volume RAR archive from `Filename-001.rar` and `Filename-002.rar` and `Filename-003.rar`. `UnRAR` is also available for Linux for free and although I don't know it for sure as not using Linux, I suppose the Linux versions of `UnRAR` work like `UnRAR.exe` for Windows. – Mofi Feb 27 '22 at 18:01
  • Please provide enough code so others can better understand or reproduce the problem. – Community Feb 27 '22 at 20:24

1 Answers1

0

I can think of three ways:

  • make a shell (such as bash) script to do this. There are many ways to do this that you can find with a Google search, so I'm not going to link them and limit you to one.
  • use Python to run shell commands: look into os.system and "subprocesses"
  • many Python solutions here: How can unrar a file with python
eccentricOrange
  • 876
  • 5
  • 18