Browse code

* s3cmd.1, NEWS: Document --exclude

git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/trunk@188 830e0280-6d2a-0410-9c65-932aecc39d9d

Michal Ludvig authored on 2008/06/09 23:17:23
Showing 4 changed files
... ...
@@ -1,6 +1,7 @@
1 1
 2008-06-10  Michal Ludvig  <michal@logix.cz>
2 2
 
3 3
 	* s3cmd: Added --exclude switch for sync.
4
+	* s3cmd.1, NEWS: Document --exclude
4 5
 
5 6
 2008-06-05  Michal Ludvig  <michal@logix.cz>
6 7
 
... ...
@@ -1,3 +1,7 @@
1
+s3cmd 0.9.8   -   ????
2
+===========
3
+* Added --exclude option for sync command.
4
+
1 5
 s3cmd 0.9.7   -   2008-06-05
2 6
 ===========
3 7
 * Implemented 'sync' from S3 back to local folder, including
... ...
@@ -1,6 +1,10 @@
1 1
 TODO list for s3cmd project
2 2
 ===========================
3 3
 
4
+- Finish sync --exclude support. 
5
+  - Add --exclude-from and --debug-exclude implementations.
6
+  - Support shell-style wildcards? Or rsync-style excludes?
7
+
4 8
 - Treat objects with "/" in their name as directories
5 9
   - Will need local cache for bucket listings
6 10
   - More user friendly 'del' operation that would work
... ...
@@ -85,6 +85,15 @@ Preserve filesystem attributes (mode, ownership, timestamps). Default for 'sync'
85 85
 .TP
86 86
 \fB\-\-no\-preserve\fR
87 87
 Don't store filesystem attributes with uploaded files.
88
+.TP
89
+\fB\-\-exclude REGEXP\fR
90
+Exclude files matching REGEXP from \fIsync\fI. See SYNC COMMAND section for more information.
91
+.TP
92
+\fB\-\-exclude\-from FILE\fR
93
+Same as \-\-exclude but reads REGEXPs from the given FILE instead of expecting them on the command line.
94
+.TP
95
+\fB\-\-debug\-exclude\fR
96
+Display detailed information about matching file names against exclude\-rules.
88 97
 .\".TP
89 98
 .\"\fB\-n\fR, \fB\-\-dry\-run\fR
90 99
 .\"Only show what would be uploaded or downloaded but don't actually do it. May still perform S3 requests to get bucket listings and other information though.
... ...
@@ -134,6 +143,56 @@ Show
134 134
 .B s3cmd
135 135
 version and exit.
136 136
 
137
+.SH SYNC COMMAND
138
+One of the most powerful commands of \fIs3cmd\fR is \fBs3cmd sync\fR used for 
139
+synchronising complete directory trees to or from remote S3 storage. 
140
+.PP
141
+Basic usage common in backup scenarios is as simple as:
142
+.nf
143
+	s3cmd sync /local/path s3://test-bucket/backup
144
+.fi
145
+.PP
146
+This command will find all files under /local/path directory and copy them 
147
+to corresponding paths under s3://test-bucket/backup on the remote side.
148
+For example:
149
+.nf
150
+/local/path\fB/file1.ext\fR         ->  s3://test-bucket/backup\fB/file1.ext\fR
151
+/local/path\fB/dir123/file2.bin\fR  ->  s3://test-bucket/backup\fB/dir123/file2.bin\fR
152
+.fi
153
+
154
+To retrieve the files back from S3 use inverted syntax:
155
+.nf
156
+	s3cmd sync s3://test-bucket/backup/ /tmp/restore
157
+.fi
158
+that will download files:
159
+.nf
160
+s3://test-bucket/backup\fB/file1.ext\fR         ->  /tmp/restore\fB/file1.ext\fR       
161
+s3://test-bucket/backup\fB/dir123/file2.bin\fR  ->  /tmp/restore\fB/dir123/file2.bin\fR
162
+.fi
163
+
164
+For the purpose of \fB\-\-exclude\fR and \fB\-\-exclude\-from\fR matching the file name 
165
+\fIalways\fR begins with \fB/\fR (slash) and has the local or remote common part removed.
166
+For instance in the previous example the file names tested against --exclude list
167
+will be \fB/\fRfile1.ext and \fB/\fRdir123/file2.bin, that is both with the leading 
168
+slash regardless whether you specified s3://test-bucket/backup or 
169
+s3://test-bucket/backup/ (note the trailing slash) on the command line.
170
+
171
+Both \fB\-\-exclude\fR and \fB\-\-exclude\-from\fR options expect regular expressions, not 
172
+shell-style wildcards! Run s3cmd with \fB\-\-debug\-exclude\fR to get a detailed list of 
173
+matching file names against exclude rules.
174
+
175
+For example to exclude all files with ".bin" extension use:
176
+.PP
177
+	\-\-exclude '\.bin$'
178
+.PP
179
+to exclude all hidden files and subdirectories (i.e. those whose name begins with dot ".") use:
180
+.PP
181
+	\-\-exclude '/\.'
182
+.PP
183
+on the other hand to exclude only hidden files but not hidden subdirectories use:
184
+.PP
185
+	\-\-exclude '/\.[^/]*$'
186
+
137 187
 .SH AUTHOR
138 188
 Written by Michal Ludvig <michal@logix.cz>
139 189
 .SH REPORTING BUGS