Extract Multiple RAR Files to One Folder with Unrar
Yes, the unrar utility can extract multiple RAR archives
into a single, merged directory. By default, unrar places
the contents of an archive directly into the specified destination path
rather than creating a separate subfolder for each archive name. This
guide demonstrates how to process multiple archives at once, avoid
subfolder creation, and handle duplicate file conflicts using both
Linux/macOS shells and Windows command-line environments.
The Core unrar
Commands
The unrar command offers two primary extraction
switches:
e(Extract without paths): Flattens the contents. All files are extracted directly into the destination directory, ignoring internal folder structures inside the RAR archives.x(Extract with full paths): Preserves the internal directory structure from within the archives, but still merges all root-level items into the target directory instead of creating a folder named after each archive.
Extracting Multiple Archives on Linux and macOS
To extract all RAR files in your current directory into a single
folder named merged_output, run:
unrar x '*.rar' /path/to/merged_output/Note: Enclose '*.rar' in single quotes to prevent
your shell from expanding the wildcard before passing it to
unrar.
If your version of unrar does not natively process shell
wildcards for batch inputs, use a standard bash loop:
for archive in *.rar; do
unrar x "$archive" /path/to/merged_output/
doneIf you want to flatten all internal directory structures so every
file lands in the top level of the destination, replace x
with e:
for archive in *.rar; do
unrar e "$archive" /path/to/merged_output/
doneExtracting Multiple Archives on Windows
Command Prompt (CMD)
Using a standard Command Prompt, navigate to the folder containing your archives and run:
for %i in (*.rar) do unrar x "%i" C:\path\to\merged_output\PowerShell
In PowerShell, pipe the target files to unrar:
Get-ChildItem -Filter *.rar | ForEach-Object { unrar x $_.FullName "C:\path\to\merged_output\" }Handling Duplicate File Names
When merging multiple archives into one folder, files with the same name across different archives will trigger an overwrite prompt. You can control this behavior using overwrite switches:
-o+(Overwrite all): Automatically overwrites existing files with the same name without asking.-o-(Skip all): Automatically skips any file that already exists in the destination folder.-or(Auto-rename): Automatically renames extracted files if a duplicate exists.
Example with auto-renaming conflicts:
unrar x -or '*.rar' /path/to/merged_output/