Switch -X<file> - exclude specified file
Exclude the specified file or folder from operation. Wildcards can be used in both the name and path parts of file mask. You can specify the switch -x several times to define several exclusion masks in the same command line.
If mask contains wildcards, it applies to files in current folder and its subfolders. It is not recursive without wildcards, so "filename" mask will exclude 'filename' file only in current folder when archiving or in root archive folder when extracting.
Use "*\filename" syntax to exclude "filename" recursively in all folders.
If you know the exact path to file, you can use "path\filename" syntax to exclude only this copy of "filename". If you use -xpath\filename syntax when unpacking an archive, "path" must be the path inside of archive, not the file path on the disk after unpacking.
By default, masks containing wildcards are applied only to files. If you need a mask with wildcards to exclude several folders, use the special syntax for folder exclusion masks. Such masks must have the trailing \ character. For example, "*tmp*\" mask will exclude all folders matching "*tmp*" and "*\tmp\" will exclude all 'tmp' folders. Since wildcards are present, both masks will be applied to contents of current folder and all its subfolders. Folder exclusion masks are supported for RAR and ZIP formats only.
If you wish to exclude only one folder, specify the exact name of folder including the absolute or relative path without any wildcards. In this case you do not need to append the path separator to mask, which is required only for folder exclusion masks containing wildcards to distinguish them from file exclusion masks.
Examples
- compress all files except *.jpg and *.avi in current folder and its subfolders
WinRAR a -r -x*.jpg -x*.avi rawfiles
- compress all files on the disk c: except temp folders and files inside of temp folders
WinRAR a -r -x*\temp\ savec c:\*
- extract all files except *.txt from docs.rar
WinRAR x -x*.txt docs