Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unrar all file in directory without prompting

I tried:

find . -name "*.rar" -exec unrar x -o {} \;

Output:

Extracting from ./setup.part2.rar

Extracting from ./setup.part1.rar

RORY/nsfw.zip already exists. Overwrite it ? [Y]es, [N]o, [A]ll, n[E]ver, [R]ename, [Q]uit A

I can't have this prompting me; both hands occupied unfortunately. thought the -o flag would do it, but nope.

like image 606
Rory Zipher Avatar asked Mar 29 '14 11:03

Rory Zipher


People also ask

How do I unrar all files in a directory?

To open/extract a RAR file in a specific path or destination directory, just use the unrar e option, it will extract all the files in the specified destination directory.

How do I unrar a folder?

rar” name as the extraction folder. Option 2: On WinRAR, click on “File,” then on “Open Archive.” Browse your folders to find the file you want to open, then click the “Extract to” button. Option 3: Double-clicking on a RAR file in Explorer will also automatically open it in the WinRAR window.

How do I unrar multiple folders?

Another way of extracting multiple RAR is explained below.Locate the archive on your machine and select them all. Right-click on any one of the archives. From the list of options, select 'Extract each archive to separate folder' and WinRAR will extract the archives in the same folder.

How do I unrar multiple files in Linux?

Doing so through the Linux UI is fairly simple; all you need to do is select all the files you want to extract, right-click, and use the extract option to extract them altogether. The real deal is when we want to do the same task through the command line.


2 Answers

You need to specify -o+ to enable automatic overwriting:

find . -name "*.rar" -exec unrar x -o+ {} \;

From unrar usage:

o[+|-]        Set the overwrite mode
like image 167
devnull Avatar answered Oct 11 '22 03:10

devnull


Do not list *.rar files in other directories (only where the command is run) using maxdepth. Remove print or messages on the screen with -inul.

find . -maxdepth 1 -type f -name "*.rar" -exec unrar x -o+ -inul {} \;

like image 22
Thiago Silva Avatar answered Oct 11 '22 01:10

Thiago Silva