Specifies a destination directory where files are to be extracted.
This switch can be used only with extraction commands.
-o{dir_path}
In Linux, you can use -spod switch to disable replacing asterisk (*) in {dir_path}.
Specifies the path generation mode for the output directory for archive extraction. The output directory path is generated from the path specified in the -o{dir_path} switch and the name of the archive being unpacked.
-spo[d | c | r]
| Switch | Description |
|---|---|
| -spod | for Linux/Posix/macOS: -o{dir_path} specifies the direct path to the output directory. The asterisk (*) character in {dir_path} will not be replaced by the archive name. |
| -spoc | 7-Zip will concatenate the path specified in -o{dir_path} with the archive name to form the final path to the output directory. |
| -spor | 7-Zip will replace asterisk (*) character in the path specified in the -o{dir_path} with the archive name. This is the default option. |
7z x "-oc:\Doc" archive.zip
extracts all files from the archive.zip archive to the c:\Doc directory.
7z x "-o*" "*.zip"or
7z x -spoc "*.zip"
extracts all *.zip archives to subfolders with names of these archives.
7z x -spoc "-oname1\name2" "*.zip"
extracts all *.zip archives to name1\name2\* subfolders. 7-Zip will concatenate name1\name2\ with the archive name to form the final path to the output directory.
7z x -spod "-oname1/long*name" archive.zip
For Linux/Posix/macOS: it extracts archive.zip archives to name1/long*name directory. In that case 7-Zip doesn't replace the asterisk (*) character with the archive name.