table of contents
WIMLIB-IMAGEX(1) | User Commands | WIMLIB-IMAGEX(1) |
NAME¶
wimlib-imagex-extract - Extract files or directories from a WIM image
SYNOPSIS¶
wimlib-imagex extract WIMFILE IMAGE [(PATH | @LISTFILE)...] [OPTION...]
DESCRIPTION¶
wimlib-imagex extract extracts one or more files or directory trees from the specified IMAGE contained in the Windows Imaging (WIM) file WIMFILE. This command is also available as simply wimextract if the appropriate hard link or batch file has been installed.
wimlib-imagex extract is intended for extracting only a subset of a WIM image. If you want to extract or "apply" a full WIM image to a directory or NTFS volume, use wimlib-imagex apply (1) instead.
IMAGE specifies the image in WIMFILE that contains the files or directory trees to extract. It may be a 1-based index of an image in the WIM or the name of an image in the WIM. Use the wimlib-imagex info (1) command to show what images a WIM file contains.
If no additional arguments are given, the entire WIM image is extracted. Otherwise, each additional argument is interpreted as a PATH if it does not begin with the '@' character, or a LISTFILE if it does. Each PATH specifies a file or directory tree within the WIM image to extract, whereas each LISTFILE specifies a file that itself contains a list of paths to extract. See PATHS AND LISTFILES for more details.
By default, files and directories are extracted to the current directory. Use --dest-dir to select a different destination directory. Alternatively, use --to-stdout to extract a file to standard output to pipe into another program.
A file or directory extracted from a PATH argument is by default extracted directly into the destination directory, whereas a file or directory extracted from a LISTFILE argument is by default extracted into the destination directory in such a way that the archive's directory structure is preserved. Use --preserve-dir-structure to always get the latter behavior.
wimlib-imagex extract supports extracting files and directory trees from stand-alone WIMs as well as split WIMs. See SPLIT WIMS.
PATHS AND LISTFILES¶
Each path, including those on the command line and those in listfiles, must be specified as an absolute path starting from the root of the WIM image, like those output by the wimlib-imagex dir (1) command. However, path separators may be either forward or backward slashes, and the leading slash is optional.
On Windows, by default paths are treated case-insensitively, whereas on UNIX-like systems, by default paths are treated case-sensitively. In either case, the default behavior may be overridden through the WIMLIB_IMAGEX_IGNORE_CASE environmental variable, as documented in wimlib-imagex (1).
By default, each path may contain the wildcard characters '?' and '*'. The '?' character matches any non-path-separator character, whereas the '*' character matches zero or more non-path-separator characters. Consequently, a single wildcard path, or "glob", may expand to multiple actual files or directories. Use the --no-globs option to disable wildcard matching and search for each path literally.
Each LISTFILE must be a text file (UTF-8 or UTF-16LE encoded; plain ASCII is also fine) that contains a list of paths to extract, one per line. Wildcard characters are allowed by default. The following demonstrates an example listfile:
; This is a comment (begins with semicolon) # This is also a comment (begins with number sign) /Users /Windows/explorer.exe /Windows/System32/en-US/* ; Both forward and backslashes are valid. ; It's not necessary to quote paths containing internal spaces. \Program Files\A* ; Leading and trailing whitespace is ignored
\Windows\notepad*
SPLIT WIMS¶
You may use wimlib-imagex extract to extract files or directory trees from a split WIM. This uses the --refs="GLOB" option in the same way as in other commands such as wimlib-imagex apply. See wimlib-imagex apply (1) for more details.
OPTIONS¶
- --check
- When reading WIMFILE, verify its integrity if an integrity table is present.
- --ref="GLOB"
- File glob of additional WIMs or split WIM parts to reference resources from. See SPLIT_WIMS. Note: GLOB is listed in quotes because it is interpreted by wimlib-imagex and may need to be quoted to protect against shell expansion.
- --dest-dir=DIR
- Extract the files and directories to the directory DIR instead of to the current working directory.
- --to-stdout
- Extract the files to standard output instead of to the filesystem. This can only be provided if all the specified paths are to regular files (not directories or reparse points). If present, alternate data streams are not extracted.
- --unix-data
- See the documentation for this option in wimlib-imagex-apply (1).
- --no-acls
- See the documentation for this option in wimlib-imagex-apply (1).
- --strict-acls
- See the documentation for this option in wimlib-imagex-apply (1).
- --no-attributes
- See the documentation for this option in wimlib-imagex-apply (1).
- --include-invalid-names
- See the documentation for this option in wimlib-imagex-apply (1).
- --no-globs
- Do not recognize wildcard characters in paths. Each path will be searched for literally. In addition, if case insensitivity is enabled, do not allow a single path to match multiple files with the same case-insensitive name but different case-sensitive names.
- --no-wildcards is also accepted as an alias for this option.
- --nullglob
- If a glob does not match any files, ignore it and print a warning instead of failing with an error. In other words, this option allows a glob to successfully match zero files.
- This option also affects paths that do not contain wildcard characters, since such paths are still considered globs unless --no-globs is enabled. If case-insensitivity is enabled, such a glob could match multiple files with the same case-insensitive name but different case-sensitive names, whereas a non-glob path (with --no-globs) can match at most one file.
- --preserve-dir-structure
- When extracting paths, preserve the archive directory structure instead of extracting the file or directory tree named by each path directly to the destination directory. Note: --preserve-dir-structure is already the default behavior for paths in listfiles, but not paths directly specified on the command line.
- --wimboot
- See the documentation for this option in wimlib-imagex-apply (1).
- --compact=FORMAT
- See the documentation for this option in wimlib-imagex-apply (1).
NOTES¶
See the documentation wimlib-imagex apply (1) for documentation about what data and metadata are extracted on UNIX-like systems versus on Windows.
On UNIX-like systems that support userspace filesystems with FUSE (e.g. Linux), one can alternatively mount the WIM image with wimlib-imagex mount (1) and then extract the desired files or directories using any standard command-line or graphical program.
Reparse-point fixups (a.k.a. changing absolute symbolic links and junctions to point within the extraction location) are never done by wimlib-imagex extract. Use wimlib-imagex apply if you want this behavior.
Unlike wimlib-imagex apply, wimlib-imagex extract does not support extracting files directly to an NTFS volume using libntfs-3g.
wimlib v1.6.0 and later can extract files from version 3584 WIMs, which usually contain LZMS-compressed solid resources and may carry the .esd file extension rather than .wim. However, .esd files downloaded directly by the Windows 8 web downloader have encrypted segments, and wimlib cannot extract such files until they are first decrypted. Furthermore, such files are not designed for random access, so extracting individual files from them may be slow.
EXAMPLES¶
Extract a file from the first image in "boot.wim" to the current directory:
wimlib-imagex extract boot.wim 1 /Windows/System32/notepad.exe
Extract a file from the first image in "boot.wim" to standard output:
wimlib-imagex extract boot.wim 1 /Windows/System32/notepad.exe \
Extract a file from the first image in "boot.wim" to the specified directory:
wimlib-imagex extract boot.wim 1 /Windows/System32/notepad.exe \
Extract the "sources" directory from the first image in "boot.wim" to the current directory:
wimlib-imagex extract boot.wim 1 /sources
Extract multiple files and directories in one command:
wimlib-imagex extract boot.wim 1 /Windows/Fonts \
Extract many files to the current directory using a wildcard pattern:
wimlib-imagex extract install.wim 1 "/Windows/Fonts/*.ttf"
Extract files using a list file:
wimlib-imagex extract install.wim 1 @files.txt
... where files.txt could be something like:
Windows\System32\*.* Windows\System32\??-??\*.* Windows\System32\en-US\*.*
SEE ALSO¶
wimlib-imagex(1) wimlib-imagex-apply(1) wimlib-imagex-dir(1) wimlib-imagex-info(1) wimlib-imagex-mount(1)
August 2016 | wimlib 1.10.0 |