Unrar Skip Existing Files Without Prompting
When extracting RAR archives using the command line, the
unrar utility defaults to pausing execution and prompting
the user whenever a file with the same name already exists in the target
directory. This guide explains how to bypass this prompt using the
-o- switch, allowing unrar to automatically
skip any existing files and continue extracting the remaining archive
contents uninterrupted.
To tell unrar to skip existing files without prompting,
add the -o- switch to your extraction command.
Basic Command Syntax
For extracting an archive while preserving the internal directory
structure, use the x command:
unrar x -o- archive.rarIf you want to extract all files into a single flat directory without
preserving folder paths, use the e command instead:
unrar e -o- archive.rarExtracting to a Specific Directory
To extract files to a specific destination folder while skipping duplicates, append the destination path with a trailing slash to the end of the command:
unrar x -o- archive.rar /path/to/destination/How the Switch Works
The unrar utility uses the -o family of
switches to control file overwriting behavior:
-o-: Do not overwrite existing files (skips them silently without prompting).-o+: Overwrite all existing files without prompting.-or: Automatically rename files if a duplicate exists.
By including -o-, unrar verifies each file
before extraction. If a file with the same name is detected in the
destination path, it is skipped immediately, allowing automated batch
scripts, cron jobs, or bulk extraction tasks to run to completion
without user intervention.