- x - eXtract files with full paths
- e - Extract files without directory structure
Syntax
Difference Between x and e
x (eXtract with paths)
Extracts files with full directory structure preserved.Example:
file/data.txt → output/file/data.txte (Extract)
Extracts all files to the same directory, ignoring paths.Example:
file/data.txt → output/data.txtCommon Options
string
required
Name of the archive to extract. 7-Zip auto-detects archive type.
string
Specific files or patterns to extract. If omitted, extracts all files.Example:
*.txt or documents/report.pdfstring
Set output directory. No space between
-o and the path.Example: -o/home/user/output or -oC:\Outputstring
Provide password for encrypted archives. Omit password to be prompted.Example:
-pMyPassword or -p (prompts)flag
Assume Yes on all queries (overwrite without prompting).
string
Set overwrite mode:
a- Overwrite all existing filess- Skip existing filest- Auto-rename extracting fileu- Auto-rename existing file
-aoa (overwrite all)string
Set archive type (usually auto-detected).Example:
-t7z or -tzipflag
Recurse subdirectories (enabled by default for archives).
string
Exclude files by pattern.Example:
-x!*.tmp -x!*.bakstring
Include only files matching pattern.Example:
-i!*.txtflag
Write data to stdout (for piping).
flag
Read archive from stdin.
flag
Eliminate duplication of root folder for extract command.
flag
Use fully qualified file paths (include drive letter on Windows).
flag
Store hard links as links (extract as links, not copies).
flag
Store symbolic links as links (extract as links, not file contents).
flag
Store NT security information (Windows).
flag
Store NTFS alternate streams (Windows).
Examples
Extract archive with full paths
Extract to specific directory
Extract without directory structure
Extract password-protected archive
Extract specific files
Extract files by pattern
Extract and overwrite without prompting
Extract and skip existing files
Extract and auto-rename new files
file.txt, file_1.txt, file_2.txt, etc.
Extract excluding certain files
Extract only specific file types
Extract to stdout (piping)
Extract multi-volume archive
Extract nested archives
Test before extracting
Advanced Examples
Extract with progress to stderr
Extract preserving timestamps
Extract case-sensitive (Linux)
Extract from stdin
Extract multiple archives
Extract with full paths including drive (Windows)
Overwrite Modes
The-ao switch controls behavior when extracted files already exist:
Interactive Prompt (default)
Without-ao or -y, 7-Zip prompts for each file:
Working with Different Archive Types
ZIP archives
TAR.GZ archives
RAR archives
ISO images
Split archives
The
x command is recommended for most use cases as it preserves the directory structure. Use e only when you specifically want all files in one directory.Exit Codes
Related Commands
- List Command (l) - View archive contents
- Test Command (t) - Test archive integrity
- Add Command (a) - Create archives