File: syntax.htm

package info (click to toggle)
p7zip 16.02%2Bdfsg-3%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 14,112 kB
  • sloc: cpp: 167,145; ansic: 14,992; python: 1,911; asm: 1,688; sh: 1,132; makefile: 701
file content (120 lines) | stat: -rw-r--r-- 4,068 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
  <META http-equiv="Content-Type" content="text/html; charset=Windows-1252">
  <TITLE>Command Line Syntax</TITLE>
  <LINK href="style.css" rel="stylesheet" type="text/css">
</HEAD>

<BODY>

<H1>Command Line Syntax</H1>

<PRE class = "syntax">
7z <A href = "commands/index.htm">&lt;command></A> [<A href = "switches/index.htm">&lt;switch></A>...] &lt;base_archive_name> [&lt;arguments>...]
</PRE>
<PRE class = "syntax">
&lt;arguments> ::= <A href = "switches/index.htm">&lt;switch></A> | &lt;wildcard> | &lt;filename> | &lt;list_file>
<A href = "switches/index.htm">&lt;switch></A>::= &lt;switch_symbol>&lt;switch_characters>[&lt;option>]
&lt;switch_symbol> ::= '/' | '-' 
&lt;list_file> ::= @{filename}
</PRE>


<P>Expressions in square brackets (between '[' and ']') are optional.</P>

<P>Expressions in curly braces ('{' and '}') mean that instead of that 
Expression (including braces), the user must substitute some string.</P>

<P>Expression</P>

<PRE class = "syntax">
expression1 | expression2 | ... | expressionN</DT>
</PRE>

<P>
means that any (but only one) from these expressions must be specified.

<P><A href = "commands/index.htm">Commands</A> and
<A href = "switches/index.htm">switches</A> can be entered in upper or lower case.</P>

<P>Command is the first non-switch argument.</P>

<P>The "base_archive_name" must be the first filename on the command line
after the command.</P>

<P>The switches and other filenames can be in any order.</P>

<P>Wildcards or filenames with spaces must be quoted:</P>

<PRE>
    "Dir\Program files\*"
    Dir\"Program files"\*
</PRE>

<P>Switch options can be combined to save command line length. However, some
switch options take optional string arguments and therefore, must be the
last option in a combined argument token string because 7-Zip accepts the
rest of the argument token as the optional argument.</P>

<P>7-Zip uses wild name matching similar to Windows 95:</P>
<UL>
  <LI><B>'*'</B> means a sequence of arbitrary characters.</LI>
  <LI><B>'?'</B> means any character.</LI>
</UL>

<P><B>
7-Zip doesn't use the system wildcard parser.   7-Zip doesn't
follow the archaic rule by which *.* means any file. 7-Zip treats
*.* as matching the name of any file that has an extension. To process all files, you must
use a * wildcard.</B></P>

<P>Examples:</P>
<TABLE border = "0">
  <TR><TD>*.txt</TD><TD>means all files with an extension of ".txt"</TD></TR>
  <TR><TD>?a*</TD><TD>means all files with a second character of "a"</TD></TR>
  <TR><TD>*1*</TD><TD>means all names that contains character "1"</TD></TR>
  <TR><TD>*.*.*</TD><TD>means all names that contain two at least "." characters</TD></TR>
</TABLE>


<P>The default wildcard "*" will be used if there is no filename/wildcard in the
command line.</P>

<P>Slash ('\') at the end of a path means a directory. Without a Slash ('\') at
the end of the path, the path can refer either to a file or a directory.


<H2><A name = "ListFile"></A>List file</H2>

<P>You can supply one or more filenames or wildcards for special list files
(files containing lists of files). The filenames in such list file must be
separated by new line symbol(s).</P>

<P>For list files, 7-Zip uses UTF-8 encoding by default. You can change encoding
using <A href = "switches/charset.htm">-scs</A> switch.</P>

<P>Multiple list files are supported.</P>

<P>For example, if the file "listfile.txt" contains the following:</P>

<PRE>
    My programs\*.cpp
    Src\*.cpp
</PRE>
<P>then the command</P>

<PRE>
    7z a -tzip archive.zip @listfile.txt
</PRE>

<P>adds to the archive "archive.zip" all "*.cpp" files from directories "My
programs" and "Src".</P>

<H2><A name = "ListFile"></A>Short and Long File Names</H2>

<P>7-Zip supports short file names  (like FILENA~1.TXT) in some cases. 
However, it's strongly recommended to use only the real (long) file names.</P>

</BODY>
</HTML>