1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
---|
2 | <HTML>
|
---|
3 | <HEAD>
|
---|
4 | <META http-equiv="Content-Type" content="text/html; charset=Windows-1252">
|
---|
5 | <TITLE>-u (Update options) switch</TITLE>
|
---|
6 | <LINK href="style.css" rel="stylesheet" type="text/css">
|
---|
7 | </HEAD>
|
---|
8 |
|
---|
9 | <BODY>
|
---|
10 |
|
---|
11 | <H1>-u (Update options) switch</H1>
|
---|
12 |
|
---|
13 | <P>Specifies how to update files in an archive and (or) how to create new archives.</P>
|
---|
14 |
|
---|
15 | <H4>Syntax</H4>
|
---|
16 |
|
---|
17 | <PRE class="syntax">
|
---|
18 | -u<A class="parameter" href="#disable_base_archive">[-]</A><action_set><A class="parameter" href="#new_archive_name">[!{new_archive_name}]</A>
|
---|
19 |
|
---|
20 | <action_set> ::= <state_action>...
|
---|
21 |
|
---|
22 | <state_action> ::= <A class="parameter" href="#state"><state></A><A class="parameter" href="#state"><action></A>
|
---|
23 |
|
---|
24 | <A class="parameter" href="#action"><state></A> ::= p | q | r | x | y | z | w
|
---|
25 |
|
---|
26 | <A class="parameter" href="#action"><action></A> ::= 0 | 1 | 2 | 3
|
---|
27 | </PRE>
|
---|
28 |
|
---|
29 |
|
---|
30 | <H4>Parameters</H4>
|
---|
31 |
|
---|
32 | <DL>
|
---|
33 | <DT><A name="disable_base_archive"></A>dash (-)</DT>
|
---|
34 | <DD><P>Disables any updates in the base archive.</P>
|
---|
35 |
|
---|
36 | <P>The term <B>base archive</B> means the archive assigned by "base_archive_name"
|
---|
37 | on the command line. See <A href="../syntax.htm">Command line syntax</A>
|
---|
38 | for more details.</P>
|
---|
39 | </DD>
|
---|
40 | <DT><A name="new_archive_name"></A>{new_archive_name}</DT>
|
---|
41 | <DD><P>Specifies the path name of the new archive to be created.
|
---|
42 | All options in this switch will refer to this new archive.</P>
|
---|
43 | <P>If not assigned, then all options in this switch will
|
---|
44 | refer to the base archive of the command.</P>
|
---|
45 | </DD>
|
---|
46 | <DT><A name="state"></A><state></DT>
|
---|
47 | <DD><P>Specifies the state of a particular file to be processed.</P>
|
---|
48 | <PRE class="syntax"><state> ::= p | q | r | x | y | z | w</PRE>
|
---|
49 | <P>For each unique filename there are 6 variants of state:</P>
|
---|
50 | <TABLE>
|
---|
51 | <TR> <TH><state></TH> <TH>State condition</TH>
|
---|
52 | <TH width="20%">File on Disk</TH> <TH width="20%">File in Archive</TH> </TR>
|
---|
53 |
|
---|
54 | <TR> <TD align="center">p</TD> <TD>File exists in archive, but is not matched with wildcard.</TD>
|
---|
55 | <TD> </TD> <TD>Exists, but is not matched</TD> </TR>
|
---|
56 |
|
---|
57 | <TR> <TD align="center">q</TD> <TD>File exists in archive, but doesn't exist on disk.</TD>
|
---|
58 | <TD>Doesn't exist</TD> <TD>Exists</TD> </TR>
|
---|
59 |
|
---|
60 | <TR> <TD align="center">r</TD> <TD>File doesn't exist in archive, but exists on disk.</TD>
|
---|
61 | <TD>Exists</TD> <TD>Doesn't exist</TD> </TR>
|
---|
62 |
|
---|
63 | <TR> <TD align="center">x</TD> <TD>File in archive is newer than the file on disk.</TD>
|
---|
64 | <TD>Older</TD> <TD>Newer</TD> </TR>
|
---|
65 |
|
---|
66 | <TR> <TD align="center">y</TD> <TD>File in archive is older than the file on disk.</TD>
|
---|
67 | <TD>Newer</TD> <TD>Older</TD> </TR>
|
---|
68 |
|
---|
69 | <TR> <TD align="center">z</TD> <TD>File in archive is same as the file on disk</TD>
|
---|
70 | <TD>Same</TD> <TD>Same</TD> </TR>
|
---|
71 |
|
---|
72 | <TR> <TD align="center">w</TD> <TD>Can not be detected what file is newer
|
---|
73 | (times are the same, sizes are different)</TD>
|
---|
74 | <TD>?</TD> <TD>?</TD> </TR>
|
---|
75 | </TABLE>
|
---|
76 | </DD>
|
---|
77 |
|
---|
78 | <DT><A name="action"></A><action></DT>
|
---|
79 | <DD><P>Specifies the action for a given <A class="parameter" href="#state"><state></A>.</P>
|
---|
80 | <PRE class="syntax"><action> ::= 0 | 1 | 2 | 3</PRE>
|
---|
81 | <P>For each state you can specify one of the three variants of actions:</P>
|
---|
82 | <TABLE>
|
---|
83 | <TR> <TH><action></TH> <TH>Description</TH></TR>
|
---|
84 | <TR> <TD align="center">0</TD> <TD>Ignore file (don't create item in new archive for this file)</TD></TR>
|
---|
85 | <TR> <TD align="center">1</TD> <TD>Copy file (copy from old archive to new)</TD></TR>
|
---|
86 | <TR> <TD align="center">2</TD> <TD>Compress (compress file from disk to new archive)</TD></TR>
|
---|
87 | <TR> <TD align="center">3</TD> <TD>Create Anti-item (item that will delete file or directory during extracting). This feature is supported only in 7z format.</TD></TR>
|
---|
88 | </TABLE>
|
---|
89 | </DD>
|
---|
90 | </DL>
|
---|
91 |
|
---|
92 |
|
---|
93 | <H4>Remarks</H4>
|
---|
94 |
|
---|
95 | <P>Any update command (such as <A href="../commands/add.htm">a (Add)</A>,
|
---|
96 | <A href="../commands/delete.htm">d (Delete)</A>,
|
---|
97 | <A href="../commands/update.htm">u (Update)</A>) can be assigned in these terms.</P>
|
---|
98 | <P>The following table shows action sets for update commands.</P>
|
---|
99 |
|
---|
100 | <TABLE>
|
---|
101 | <TR> <TH>command \ <A class="parameter" href="#state"><state></A></TH>
|
---|
102 | <TH>p</TH> <TH>q</TH> <TH>r</TH> <TH>x</TH> <TH>y</TH> <TH>z</TH> <TH>w</TH></TR>
|
---|
103 | <TR> <TH><A href="../commands/delete.htm">d (Delete)</A></TH> <TD>1</TD> <TD>0</TD> <TD>0</TD> <TD>0</TD> <TD>0</TD> <TD>0</TD> <TD>0</TD></TR>
|
---|
104 | <TR> <TH><A href="../commands/add.htm">a (Add)</A></TH> <TD>1</TD> <TD>1</TD> <TD>2</TD> <TD>2</TD> <TD>2</TD> <TD>2</TD> <TD>2</TD></TR>
|
---|
105 | <TR> <TH><A href="../commands/update.htm">u (Update)</A></TH> <TD>1</TD> <TD>1</TD> <TD>2</TD> <TD>1</TD> <TD>2</TD> <TD>1</TD> <TD>2</TD></TR>
|
---|
106 | <TR> <TH>Freshen</TH> <TD>1</TD> <TD>1</TD> <TD>0</TD> <TD>1</TD> <TD>2</TD> <TD>1</TD> <TD>2</TD></TR>
|
---|
107 | <TR> <TH>Synchronize</TH> <TD>1</TD> <TD>0</TD> <TD>2</TD> <TD>1</TD> <TD>2</TD> <TD>1</TD> <TD>2</TD></TR>
|
---|
108 | </TABLE>
|
---|
109 |
|
---|
110 |
|
---|
111 | <P>If you don't specify a
|
---|
112 | <A class="parameter" href="#new_archive_name"><I>!{new_archive_name}</I></A> option, then
|
---|
113 | all options will refer to the main archive (the archive assigned on the command line after the 7z command).
|
---|
114 | If you specify <A class="parameter" href="#new_archive_name"><I>!{new_archive_name}</I></A>
|
---|
115 | option, then 7-Zip also will create a new archive with the specified name and all options
|
---|
116 | will refer to that new archive.</P>
|
---|
117 |
|
---|
118 | <P>Multiple update switches are supported.
|
---|
119 | 7-Zip can create any number of new archives during one operation.</P>
|
---|
120 |
|
---|
121 | <P>By default, the action set for each new archive is assigned
|
---|
122 | as the action set of the main command. There are 3 different
|
---|
123 | action sets for commands: <A href="../commands/add.htm">a (Add)</A>,
|
---|
124 | <A href="../commands/delete.htm">d (Delete)</A>,
|
---|
125 | <A href="../commands/update.htm">u (Update)</A>.
|
---|
126 | You can overload any <state_action> pair.</P>
|
---|
127 |
|
---|
128 | <H4>Time zone notes</H4>
|
---|
129 | <P>If you change time zone (when you move your computer to another time zone
|
---|
130 | or if there are clock changes for daylight saving in your zone), you can have some problems
|
---|
131 | with update commands that depend from file's modification time. It's strongly recommended to use only
|
---|
132 | file system that uses Coordinated Universal Time (UTC) and archive format that also uses UTC.
|
---|
133 | In that case you will have no problems with time zone changes.
|
---|
134 | Also it's recommended to use only UTC formats in other cases, for example, if you send files to
|
---|
135 | someone in another time zone.</P>
|
---|
136 |
|
---|
137 | <P>Also in some cases there are no problems, if both file system and archive format use local time, for example, FAT file system and ZIP format.</P>
|
---|
138 | <UL>
|
---|
139 | <LI>UTC file systems: NTFS
|
---|
140 | <LI>UTC archive formats: .zip with -mtc switch, 7z, tar, gzip2, iso, wim
|
---|
141 | <LI>Local time file systems : FAT, FAT32
|
---|
142 | <LI>Local time archive formats : rar, zip, cab
|
---|
143 | </UL>
|
---|
144 |
|
---|
145 | <H4>Examples</H4>
|
---|
146 |
|
---|
147 | <PRE class="example">
|
---|
148 | 7z u c:\1\exist.7z -u- -up0q3x2z0!c:\1\update.7z *
|
---|
149 | </PRE>
|
---|
150 |
|
---|
151 | <P>creates a new archive <SPAN class="filename">update.7z</SPAN> and
|
---|
152 | writes to this archive all files from current directory which differ from
|
---|
153 | files in <SPAN class="filename">exist.7z</SPAN> archive.
|
---|
154 | <SPAN class="filename">exist.7z</SPAN> archive will not be changed.</P>
|
---|
155 |
|
---|
156 | <PRE class="example">
|
---|
157 | 7z u c:\1\exist.7z -up0q3x2z0!c:\1\update.7z * -ms=off
|
---|
158 | </PRE>
|
---|
159 |
|
---|
160 | <P>creates a new archive <SPAN class="filename">update.7z</SPAN> and
|
---|
161 | writes to this archive all files from the current directory which differ from
|
---|
162 | files in <SPAN class="filename">exist.7z</SPAN> archive.
|
---|
163 |
|
---|
164 | <P>Note: the updating of solid .7z archives can be slow, since it
|
---|
165 | can require some recompression.</P>
|
---|
166 |
|
---|
167 | <H4>Commands that can be used with this switch</H4>
|
---|
168 |
|
---|
169 | <P>
|
---|
170 | <A href="../commands/add.htm">a (Add)</A>,
|
---|
171 | <A href="../commands/delete.htm">d (Delete)</A>,
|
---|
172 | <A href="../commands/update.htm">u (Update)</A>,
|
---|
173 | </P>
|
---|
174 |
|
---|
175 | </BODY>
|
---|
176 | </HTML>
|
---|