Permalink
Browse files

* s3cmd.1, NEWS: Document --exclude

git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/trunk@188 830e0280-6d2a-0410-9c65-932aecc39d9d
  • Loading branch information...
1 parent 711318e commit ee852c0a142518cca38a58cdf517a5c411134b36 @mludvig mludvig committed Jun 9, 2008
Showing with 68 additions and 0 deletions.
  1. +1 −0 ChangeLog
  2. +4 −0 NEWS
  3. +4 −0 TODO
  4. +59 −0 s3cmd.1
View
@@ -1,6 +1,7 @@
2008-06-10 Michal Ludvig <michal@logix.cz>
* s3cmd: Added --exclude switch for sync.
+ * s3cmd.1, NEWS: Document --exclude
2008-06-05 Michal Ludvig <michal@logix.cz>
View
4 NEWS
@@ -1,3 +1,7 @@
+s3cmd 0.9.8 - ????
+===========
+* Added --exclude option for sync command.
+
s3cmd 0.9.7 - 2008-06-05
===========
* Implemented 'sync' from S3 back to local folder, including
View
4 TODO
@@ -1,6 +1,10 @@
TODO list for s3cmd project
===========================
+- Finish sync --exclude support.
+ - Add --exclude-from and --debug-exclude implementations.
+ - Support shell-style wildcards? Or rsync-style excludes?
+
- Treat objects with "/" in their name as directories
- Will need local cache for bucket listings
- More user friendly 'del' operation that would work
View
59 s3cmd.1
@@ -85,6 +85,15 @@ Preserve filesystem attributes (mode, ownership, timestamps). Default for 'sync'
.TP
\fB\-\-no\-preserve\fR
Don't store filesystem attributes with uploaded files.
+.TP
+\fB\-\-exclude REGEXP\fR
+Exclude files matching REGEXP from \fIsync\fI. See SYNC COMMAND section for more information.
+.TP
+\fB\-\-exclude\-from FILE\fR
+Same as \-\-exclude but reads REGEXPs from the given FILE instead of expecting them on the command line.
+.TP
+\fB\-\-debug\-exclude\fR
+Display detailed information about matching file names against exclude\-rules.
.\".TP
.\"\fB\-n\fR, \fB\-\-dry\-run\fR
.\"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
.B s3cmd
version and exit.
+.SH SYNC COMMAND
+One of the most powerful commands of \fIs3cmd\fR is \fBs3cmd sync\fR used for
+synchronising complete directory trees to or from remote S3 storage.
+.PP
+Basic usage common in backup scenarios is as simple as:
+.nf
+ s3cmd sync /local/path s3://test-bucket/backup
+.fi
+.PP
+This command will find all files under /local/path directory and copy them
+to corresponding paths under s3://test-bucket/backup on the remote side.
+For example:
+.nf
+/local/path\fB/file1.ext\fR -> s3://test-bucket/backup\fB/file1.ext\fR
+/local/path\fB/dir123/file2.bin\fR -> s3://test-bucket/backup\fB/dir123/file2.bin\fR
+.fi
+
+To retrieve the files back from S3 use inverted syntax:
+.nf
+ s3cmd sync s3://test-bucket/backup/ /tmp/restore
+.fi
+that will download files:
+.nf
+s3://test-bucket/backup\fB/file1.ext\fR -> /tmp/restore\fB/file1.ext\fR
+s3://test-bucket/backup\fB/dir123/file2.bin\fR -> /tmp/restore\fB/dir123/file2.bin\fR
+.fi
+
+For the purpose of \fB\-\-exclude\fR and \fB\-\-exclude\-from\fR matching the file name
+\fIalways\fR begins with \fB/\fR (slash) and has the local or remote common part removed.
+For instance in the previous example the file names tested against --exclude list
+will be \fB/\fRfile1.ext and \fB/\fRdir123/file2.bin, that is both with the leading
+slash regardless whether you specified s3://test-bucket/backup or
+s3://test-bucket/backup/ (note the trailing slash) on the command line.
+
+Both \fB\-\-exclude\fR and \fB\-\-exclude\-from\fR options expect regular expressions, not
+shell-style wildcards! Run s3cmd with \fB\-\-debug\-exclude\fR to get a detailed list of
+matching file names against exclude rules.
+
+For example to exclude all files with ".bin" extension use:
+.PP
+ \-\-exclude '\.bin$'
+.PP
+to exclude all hidden files and subdirectories (i.e. those whose name begins with dot ".") use:
+.PP
+ \-\-exclude '/\.'
+.PP
+on the other hand to exclude only hidden files but not hidden subdirectories use:
+.PP
+ \-\-exclude '/\.[^/]*$'
+
.SH AUTHOR
Written by Michal Ludvig <michal@logix.cz>
.SH REPORTING BUGS

0 comments on commit ee852c0

Please sign in to comment.