wimdelete − Delete an image from a WIM archive
wimdelete WIMFILE IMAGE [OPTION...]
wimdelete, or equivalently wimlib-imagex delete, deletes the specified image from the Windows Imaging (WIM) archive WIMFILE.
IMAGE specifies the WIM image in WIMFILE to delete. It may be the 1-based index of an image, the name of an image, or the keyword "all" to specify all images. You can use wiminfo(1) to list the images contained in WIMFILE.
By default, wimdelete rebuilds the WIM with all unnecessary file data removed. This is different from Microsoft’s ImageX and DISM, which only will delete the directory tree metadata and XML data for this operation. Use --soft if you want the other kind of delete.
wimlib allows you to delete all the images from a WIM and have a WIM with 0 images, although such a file may not be very useful.
wimdelete does not support split WIMs.
Before deleting the image, verify the WIM’s integrity if extra integrity information is present. In addition, include extra integrity information in the modified WIM, even if it was not present before.
Perform a "soft delete". Specifying this flag overrides the default behavior of rebuilding the entire WIM after deleting an image. Instead, only minimal changes to correctly remove the image from the WIM will be taken. In particular, all file resources will be left alone, even if they are no longer referenced. This may not be what you want, because no space will be saved by deleting an image in this way. However, wimoptimize can later be used to rebuild a WIM file that has had images soft-deleted from it.
Compact the WIM archive in-place, eliminating "holes". This is efficient, but in general this option should not be used because a failed or interrupted compaction will corrupt the WIM archive. For more information, see the documentation for this option to wimoptimize(1).
Delete the first image from ’boot.wim’:
wimdelete boot.wim 1
wimlib-imagex(1) wiminfo(1) wimoptimize(1)