How to Specify Next Volume Directory in Unrar
When extracting multi-volume RAR archives, the unrar
utility expects all parts to reside in the same folder by default.
Because the command-line version of unrar lacks a dedicated
startup flag to define a secondary search path for subsequent volumes,
handling split archives across different locations requires either
responding to the interactive runtime prompt, piping the path through
standard input for automation, or unifying the locations using symbolic
links. This guide details how to implement each method cleanly.
Method 1: Use the Interactive Prompt
If unrar cannot locate the next volume (such as
.part2.rar or .r01) in the current working
directory, extraction halts and it prompts you to provide the
location.
- Start extracting the first volume:
unrar x /path/to/first_part/archive.part01.rar - When the initial volume finishes extracting,
unraroutputs a prompt similar to:Cannot find volume: archive.part02.rar Insert disk with this volume and press Enter, or enter the new path: - Type the absolute or relative path to the directory containing the requested volume (or the full path to the file itself) and press Enter.
unrar will switch to the specified directory and
continue processing from there.
Method 2: Automate with Standard Input Piping
If you run unrar inside an automated script and cannot
manually respond to the prompt, pipe the directory path into the command
using echo or printf.
printf "/path/to/subsequent_volumes/\n" | unrar x /path/to/archive.part01.rarWhen unrar finishes the first file and requests the next
volume, it reads the path directly from stdin without
interrupting script execution. If you have volumes scattered across more
than two directories, provide each directory on a new line:
printf "/path/to/part2/\n/path/to/part3/\n" | unrar x /path/to/archive.part01.rarMethod 3: Consolidate with Symbolic Links (Recommended)
The most reliable approach to avoid extraction failures or halted
scripts is to link all multi-volume files into a single temporary
directory before calling unrar.
- Create a temporary staging folder:
mkdir /tmp/rar_staging - Create symbolic links to all volumes:
ln -s /path/to/dir1/archive.part01.rar /tmp/rar_staging/ ln -s /path/to/dir2/archive.part02.rar /tmp/rar_staging/ ln -s /path/to/dir3/archive.part03.rar /tmp/rar_staging/ - Extract from the staging directory to your target destination:
unrar x /tmp/rar_staging/archive.part01.rar /target/output/dir/ - Remove the staging directory once extraction completes:
rm -rf /tmp/rar_staging
Because all volume links reside in the same folder,
unrar detects and processes each subsequent volume
automatically.