forked from s3tools/s3cmd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
s3cmd.1
669 lines (657 loc) · 19.8 KB
/
s3cmd.1
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
.\" !!! IMPORTANT: This file is generated from s3cmd \-\-help output using format-manpage.pl
.\" !!! Do your changes either in s3cmd file or in 'format\-manpage.pl' otherwise
.\" !!! they will be overwritten!
.TH s3cmd 1
.SH NAME
s3cmd \- tool for managing Amazon S3 storage space and Amazon CloudFront content delivery network
.SH SYNOPSIS
.B s3cmd
[\fIOPTIONS\fR] \fICOMMAND\fR [\fIPARAMETERS\fR]
.SH DESCRIPTION
.PP
.B s3cmd
is a command line client for copying files to/from
Amazon S3 (Simple Storage Service) and performing other
related tasks, for instance creating and removing buckets,
listing objects, etc.
.SH COMMANDS
.PP
.B s3cmd
can do several \fIactions\fR specified by the following \fIcommands\fR.
.TP
s3cmd \fBmb\fR \fIs3://BUCKET\fR
Make bucket
.TP
s3cmd \fBrb\fR \fIs3://BUCKET\fR
Remove bucket
.TP
s3cmd \fBls\fR \fI[s3://BUCKET[/PREFIX]]\fR
List objects or buckets
.TP
s3cmd \fBla\fR \fI\fR
List all object in all buckets
.TP
s3cmd \fBput\fR \fIFILE [FILE...] s3://BUCKET[/PREFIX]\fR
Put file into bucket
.TP
s3cmd \fBget\fR \fIs3://BUCKET/OBJECT LOCAL_FILE\fR
Get file from bucket
.TP
s3cmd \fBdel\fR \fIs3://BUCKET/OBJECT\fR
Delete file from bucket
.TP
s3cmd \fBrm\fR \fIs3://BUCKET/OBJECT\fR
Delete file from bucket (alias for del)
.TP
s3cmd \fBrestore\fR \fIs3://BUCKET/OBJECT\fR
Restore file from Glacier storage
.TP
s3cmd \fBsync\fR \fILOCAL_DIR s3://BUCKET[/PREFIX] or s3://BUCKET[/PREFIX] LOCAL_DIR\fR
Synchronize a directory tree to S3 (checks files freshness using size and md5 checksum, unless overridden by options, see below)
.TP
s3cmd \fBdu\fR \fI[s3://BUCKET[/PREFIX]]\fR
Disk usage by buckets
.TP
s3cmd \fBinfo\fR \fIs3://BUCKET[/OBJECT]\fR
Get various information about Buckets or Files
.TP
s3cmd \fBcp\fR \fIs3://BUCKET1/OBJECT1 s3://BUCKET2[/OBJECT2]\fR
Copy object
.TP
s3cmd \fBmodify\fR \fIs3://BUCKET1/OBJECT\fR
Modify object metadata
.TP
s3cmd \fBmv\fR \fIs3://BUCKET1/OBJECT1 s3://BUCKET2[/OBJECT2]\fR
Move object
.TP
s3cmd \fBsetacl\fR \fIs3://BUCKET[/OBJECT]\fR
Modify Access control list for Bucket or Files
.TP
s3cmd \fBsetpolicy\fR \fIFILE s3://BUCKET\fR
Modify Bucket Policy
.TP
s3cmd \fBdelpolicy\fR \fIs3://BUCKET\fR
Delete Bucket Policy
.TP
s3cmd \fBsetcors\fR \fIFILE s3://BUCKET\fR
Modify Bucket CORS
.TP
s3cmd \fBdelcors\fR \fIs3://BUCKET\fR
Delete Bucket CORS
.TP
s3cmd \fBpayer\fR \fIs3://BUCKET\fR
Modify Bucket Requester Pays policy
.TP
s3cmd \fBmultipart\fR \fIs3://BUCKET [Id]\fR
Show multipart uploads
.TP
s3cmd \fBabortmp\fR \fIs3://BUCKET/OBJECT Id\fR
Abort a multipart upload
.TP
s3cmd \fBlistmp\fR \fIs3://BUCKET/OBJECT Id\fR
List parts of a multipart upload
.TP
s3cmd \fBaccesslog\fR \fIs3://BUCKET\fR
Enable/disable bucket access logging
.TP
s3cmd \fBsign\fR \fISTRING\-TO\-SIGN\fR
Sign arbitrary string using the secret key
.TP
s3cmd \fBsignurl\fR \fIs3://BUCKET/OBJECT <expiry_epoch|+expiry_offset>\fR
Sign an S3 URL to provide limited public access with expiry
.TP
s3cmd \fBfixbucket\fR \fIs3://BUCKET[/PREFIX]\fR
Fix invalid file names in a bucket
.TP
s3cmd \fBexpire\fR \fIs3://BUCKET\fR
Set or delete expiration rule for the bucket
.TP
s3cmd \fBsetlifecycle\fR \fIFILE s3://BUCKET\fR
Upload a lifecycle policy for the bucket
.TP
s3cmd \fBdellifecycle\fR \fIs3://BUCKET\fR
Remove a lifecycle policy for the bucket
.PP
Commands for static WebSites configuration
.TP
s3cmd \fBws\-create\fR \fIs3://BUCKET\fR
Create Website from bucket
.TP
s3cmd \fBws\-delete\fR \fIs3://BUCKET\fR
Delete Website
.TP
s3cmd \fBws\-info\fR \fIs3://BUCKET\fR
Info about Website
.PP
Commands for CloudFront management
.TP
s3cmd \fBcflist\fR \fI\fR
List CloudFront distribution points
.TP
s3cmd \fBcfinfo\fR \fI[cf://DIST_ID]\fR
Display CloudFront distribution point parameters
.TP
s3cmd \fBcfcreate\fR \fIs3://BUCKET\fR
Create CloudFront distribution point
.TP
s3cmd \fBcfdelete\fR \fIcf://DIST_ID\fR
Delete CloudFront distribution point
.TP
s3cmd \fBcfmodify\fR \fIcf://DIST_ID\fR
Change CloudFront distribution point parameters
.TP
s3cmd \fBcfinvalinfo\fR \fIcf://DIST_ID[/INVAL_ID]\fR
Display CloudFront invalidation request(s) status
.SH OPTIONS
.PP
Some of the below specified options can have their default
values set in
.B s3cmd
config file (by default $HOME/.s3cmd). As it's a simple text file
feel free to open it with your favorite text editor and do any
changes you like.
.TP
\fB\-h\fR, \fB\-\-help\fR
show this help message and exit
.TP
\fB\-\-configure\fR
Invoke interactive (re)configuration tool. Optionally
use as '\fB\-\-configure\fR s3://some\-bucket' to test access
to a specific bucket instead of attempting to list
them all.
.TP
\fB\-c\fR FILE, \fB\-\-config\fR=FILE
Config file name. Defaults to $HOME/.s3cfg
.TP
\fB\-\-dump\-config\fR
Dump current configuration after parsing config files
and command line options and exit.
.TP
\fB\-\-access_key\fR=ACCESS_KEY
AWS Access Key
.TP
\fB\-\-secret_key\fR=SECRET_KEY
AWS Secret Key
.TP
\fB\-n\fR, \fB\-\-dry\-run\fR
Only show what should be uploaded or downloaded but
don't actually do it. May still perform S3 requests to
get bucket listings and other information though (only
for file transfer commands)
.TP
\fB\-s\fR, \fB\-\-ssl\fR
Use HTTPS connection when communicating with S3.
(default)
.TP
\fB\-\-no\-ssl\fR
Don't use HTTPS.
.TP
\fB\-e\fR, \fB\-\-encrypt\fR
Encrypt files before uploading to S3.
.TP
\fB\-\-no\-encrypt\fR
Don't encrypt files.
.TP
\fB\-f\fR, \fB\-\-force\fR
Force overwrite and other dangerous operations.
.TP
\fB\-\-continue\fR
Continue getting a partially downloaded file (only for
[get] command).
.TP
\fB\-\-continue\-put\fR
Continue uploading partially uploaded files or
multipart upload parts. Restarts/parts files that
don't have matching size and md5. Skips files/parts
that do. Note: md5sum checks are not always
sufficient to check (part) file equality. Enable this
at your own risk.
.TP
\fB\-\-upload\-id\fR=UPLOAD_ID
UploadId for Multipart Upload, in case you want
continue an existing upload (equivalent to \fB\-\-continue\-\fR
put) and there are multiple partial uploads. Use
s3cmd multipart [URI] to see what UploadIds are
associated with the given URI.
.TP
\fB\-\-skip\-existing\fR
Skip over files that exist at the destination (only
for [get] and [sync] commands).
.TP
\fB\-r\fR, \fB\-\-recursive\fR
Recursive upload, download or removal.
.TP
\fB\-\-check\-md5\fR
Check MD5 sums when comparing files for [sync].
(default)
.TP
\fB\-\-no\-check\-md5\fR
Do not check MD5 sums when comparing files for [sync].
Only size will be compared. May significantly speed up
transfer but may also miss some changed files.
.TP
\fB\-P\fR, \fB\-\-acl\-public\fR
Store objects with ACL allowing read for anyone.
.TP
\fB\-\-acl\-private\fR
Store objects with default ACL allowing access for you
only.
.TP
\fB\-\-acl\-grant\fR=PERMISSION:EMAIL or USER_CANONICAL_ID
Grant stated permission to a given amazon user.
Permission is one of: read, write, read_acp,
write_acp, full_control, all
.TP
\fB\-\-acl\-revoke\fR=PERMISSION:USER_CANONICAL_ID
Revoke stated permission for a given amazon user.
Permission is one of: read, write, read_acp, wr
ite_acp, full_control, all
.TP
\fB\-D\fR NUM, \fB\-\-restore\-days\fR=NUM
Number of days to keep restored file available (only
for 'restore' command).
.TP
\fB\-\-delete\-removed\fR
Delete remote objects with no corresponding local file
[sync]
.TP
\fB\-\-no\-delete\-removed\fR
Don't delete remote objects.
.TP
\fB\-\-delete\-after\fR
Perform deletes after new uploads [sync]
.TP
\fB\-\-delay\-updates\fR
*OBSOLETE* Put all updated files into place at end
[sync]
.TP
\fB\-\-max\-delete\fR=NUM
Do not delete more than NUM files. [del] and [sync]
.TP
\fB\-\-add\-destination\fR=ADDITIONAL_DESTINATIONS
Additional destination for parallel uploads, in
addition to last arg. May be repeated.
.TP
\fB\-\-delete\-after\-fetch\fR
Delete remote objects after fetching to local file
(only for [get] and [sync] commands).
.TP
\fB\-p\fR, \fB\-\-preserve\fR
Preserve filesystem attributes (mode, ownership,
timestamps). Default for [sync] command.
.TP
\fB\-\-no\-preserve\fR
Don't store FS attributes
.TP
\fB\-\-exclude\fR=GLOB
Filenames and paths matching GLOB will be excluded
from sync
.TP
\fB\-\-exclude\-from\fR=FILE
Read --exclude GLOBs from FILE
.TP
\fB\-\-rexclude\fR=REGEXP
Filenames and paths matching REGEXP (regular
expression) will be excluded from sync
.TP
\fB\-\-rexclude\-from\fR=FILE
Read --rexclude REGEXPs from FILE
.TP
\fB\-\-include\fR=GLOB
Filenames and paths matching GLOB will be included
even if previously excluded by one of
\fB\-\-(r)exclude(\-from)\fR patterns
.TP
\fB\-\-include\-from\fR=FILE
Read --include GLOBs from FILE
.TP
\fB\-\-rinclude\fR=REGEXP
Same as --include but uses REGEXP (regular expression)
instead of GLOB
.TP
\fB\-\-rinclude\-from\fR=FILE
Read --rinclude REGEXPs from FILE
.TP
\fB\-\-files\-from\fR=FILE
Read list of source-file names from FILE. Use - to
read from stdin.
.TP
\fB\-\-region\fR=REGION, \fB\-\-bucket\-location\fR=REGION
Region to create bucket in. As of now the regions are:
us\-east\-1, us\-west\-1, us\-west\-2, eu\-west\-1, eu\-
central\-1, ap\-northeast\-1, ap\-southeast\-1, ap\-
southeast\-2, sa\-east\-1
.TP
\fB\-\-reduced\-redundancy\fR, \fB\-\-rr\fR
Store object with 'Reduced redundancy'. Lower per\-GB
price. [put, cp, mv]
.TP
\fB\-\-no\-reduced\-redundancy\fR, \fB\-\-no\-rr\fR
Store object without 'Reduced redundancy'. Higher per\-
GB price. [put, cp, mv]
.TP
\fB\-\-storage\-class\fR=CLASS
Store object with specified CLASS (STANDARD,
STANDARD_IA, or REDUCED_REDUNDANCY). Lower per\-GB
price. [put, cp, mv]
.TP
\fB\-\-access\-logging\-target\-prefix\fR=LOG_TARGET_PREFIX
Target prefix for access logs (S3 URI) (for [cfmodify]
and [accesslog] commands)
.TP
\fB\-\-no\-access\-logging\fR
Disable access logging (for [cfmodify] and [accesslog]
commands)
.TP
\fB\-\-default\-mime\-type\fR=DEFAULT_MIME_TYPE
Default MIME\-type for stored objects. Application
default is binary/octet\-stream.
.TP
\fB\-M\fR, \fB\-\-guess\-mime\-type\fR
Guess MIME\-type of files by their extension or mime
magic. Fall back to default MIME\-Type as specified by
\fB\-\-default\-mime\-type\fR option
.TP
\fB\-\-no\-guess\-mime\-type\fR
Don't guess MIME-type and use the default type
instead.
.TP
\fB\-\-no\-mime\-magic\fR
Don't use mime magic when guessing MIME-type.
.TP
\fB\-m\fR MIME/TYPE, \fB\-\-mime\-type\fR=MIME/TYPE
Force MIME\-type. Override both \fB\-\-default\-mime\-type\fR and
\fB\-\-guess\-mime\-type\fR.
.TP
\fB\-\-add\-header\fR=NAME:VALUE
Add a given HTTP header to the upload request. Can be
used multiple times. For instance set 'Expires' or
\&'Cache\-Control' headers (or both) using this option.
.TP
\fB\-\-remove\-header\fR=NAME
Remove a given HTTP header. Can be used multiple
times. For instance, remove 'Expires' or 'Cache\-
Control' headers (or both) using this option. [modify]
.TP
\fB\-\-server\-side\-encryption\fR
Specifies that server\-side encryption will be used
when putting objects. [put, sync, cp, modify]
.TP
\fB\-\-server\-side\-encryption\-kms\-id\fR=KMS_KEY
Specifies the key id used for server\-side encryption
with AWS KMS\-Managed Keys (SSE\-KMS) when putting
objects. [put, sync, cp, modify]
.TP
\fB\-\-encoding\fR=ENCODING
Override autodetected terminal and filesystem encoding
(character set). Autodetected: UTF\-8
.TP
\fB\-\-add\-encoding\-exts\fR=EXTENSIONs
Add encoding to these comma delimited extensions i.e.
(css,js,html) when uploading to S3 )
.TP
\fB\-\-verbatim\fR
Use the S3 name as given on the command line. No pre-
processing, encoding, etc. Use with caution!
.TP
\fB\-\-disable\-multipart\fR
Disable multipart upload on files bigger than
\fB\-\-multipart\-chunk\-size\-mb\fR
.TP
\fB\-\-multipart\-chunk\-size\-mb\fR=SIZE
Size of each chunk of a multipart upload. Files bigger
than SIZE are automatically uploaded as multithreaded\-
multipart, smaller files are uploaded using the
traditional method. SIZE is in Mega\-Bytes, default
chunk size is 15MB, minimum allowed chunk size is 5MB,
maximum is 5GB.
.TP
\fB\-\-list\-md5\fR
Include MD5 sums in bucket listings (only for 'ls'
command).
.TP
\fB\-H\fR, \fB\-\-human\-readable\-sizes\fR
Print sizes in human readable form (eg 1kB instead of
1234).
.TP
\fB\-\-ws\-index\fR=WEBSITE_INDEX
Name of index\-document (only for [ws\-create] command)
.TP
\fB\-\-ws\-error\fR=WEBSITE_ERROR
Name of error\-document (only for [ws\-create] command)
.TP
\fB\-\-expiry\-date\fR=EXPIRY_DATE
Indicates when the expiration rule takes effect. (only
for [expire] command)
.TP
\fB\-\-expiry\-days\fR=EXPIRY_DAYS
Indicates the number of days after object creation the
expiration rule takes effect. (only for [expire]
command)
.TP
\fB\-\-expiry\-prefix\fR=EXPIRY_PREFIX
Identifying one or more objects with the prefix to
which the expiration rule applies. (only for [expire]
command)
.TP
\fB\-\-progress\fR
Display progress meter (default on TTY).
.TP
\fB\-\-no\-progress\fR
Don't display progress meter (default on non-TTY).
.TP
\fB\-\-enable\fR
Enable given CloudFront distribution (only for
[cfmodify] command)
.TP
\fB\-\-disable\fR
Enable given CloudFront distribution (only for
[cfmodify] command)
.TP
\fB\-\-cf\-invalidate\fR
Invalidate the uploaded filed in CloudFront. Also see
[cfinval] command.
.TP
\fB\-\-cf\-invalidate\-default\-index\fR
When using Custom Origin and S3 static website,
invalidate the default index file.
.TP
\fB\-\-cf\-no\-invalidate\-default\-index\-root\fR
When using Custom Origin and S3 static website, don't
invalidate the path to the default index file.
.TP
\fB\-\-cf\-add\-cname\fR=CNAME
Add given CNAME to a CloudFront distribution (only for
[cfcreate] and [cfmodify] commands)
.TP
\fB\-\-cf\-remove\-cname\fR=CNAME
Remove given CNAME from a CloudFront distribution
(only for [cfmodify] command)
.TP
\fB\-\-cf\-comment\fR=COMMENT
Set COMMENT for a given CloudFront distribution (only
for [cfcreate] and [cfmodify] commands)
.TP
\fB\-\-cf\-default\-root\-object\fR=DEFAULT_ROOT_OBJECT
Set the default root object to return when no object
is specified in the URL. Use a relative path, i.e.
default/index.html instead of /default/index.html or
s3://bucket/default/index.html (only for [cfcreate]
and [cfmodify] commands)
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Enable verbose output.
.TP
\fB\-d\fR, \fB\-\-debug\fR
Enable debug output.
.TP
\fB\-\-version\fR
Show s3cmd version (1.6.0) and exit.
.TP
\fB\-F\fR, \fB\-\-follow\-symlinks\fR
Follow symbolic links as if they are regular files
.TP
\fB\-\-cache\-file\fR=FILE
Cache FILE containing local source MD5 values
.TP
\fB\-q\fR, \fB\-\-quiet\fR
Silence output on stdout
.TP
\fB\-\-ca\-certs\fR=CA_CERTS_FILE
Path to SSL CA certificate FILE (instead of system
default)
.TP
\fB\-\-check\-certificate\fR
Check SSL certificate validity
.TP
\fB\-\-no\-check\-certificate\fR
Do not check SSL certificate validity
.TP
\fB\-\-check\-hostname\fR
Check SSL certificate hostname validity
.TP
\fB\-\-no\-check\-hostname\fR
Do not check SSL certificate hostname validity
.TP
\fB\-\-signature\-v2\fR
Use AWS Signature version 2 instead of newer signature
methods. Helpful for S3\-like systems that don't have
AWS Signature v4 yet.
.TP
\fB\-\-limit\-rate\fR=LIMITRATE
Limit the upload or download speed to amount bytes per
second. Amount may be expressed in bytes, kilobytes
with the k suffix, or megabytes with the m suffix
.TP
\fB\-\-requester\-pays\fR
Set the REQUESTER PAYS flag for operations
.TP
\fB\-l\fR, \fB\-\-long\-listing\fR
Produce long listing [ls]
.TP
\fB\-\-stop\-on\-error\fR
stop if error in transfer
.TP
\fB\-\-content\-disposition\fR=CONTENT_DISPOSITION
Provide a Content\-Disposition for signed URLs, e.g.,
"inline; filename=myvideo.mp4"
.TP
\fB\-\-content\-type\fR=CONTENT_TYPE
Provide a Content\-Type for signed URLs, e.g.,
"video/mp4"
.SH EXAMPLES
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. To some extent
\fBs3cmd put\fR and \fBs3cmd get\fR share a similar behaviour with \fBsync\fR.
.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/\fBfile1.ext\fR \-> s3://bucket/backup/\fBfile1.ext\fR
/local/path/\fBdir123/file2.bin\fR \-> s3://bucket/backup/\fBdir123/file2.bin\fR
.fi
.PP
However if the local path doesn't end with a slash the last directory's name
is used on the remote side as well. Compare these with the previous example:
.nf
s3cmd sync /local/path s3://test\-bucket/backup/
.fi
will sync:
.nf
/local/\fBpath/file1.ext\fR \-> s3://bucket/backup/\fBpath/file1.ext\fR
/local/\fBpath/dir123/file2.bin\fR \-> s3://bucket/backup/\fBpath/dir123/file2.bin\fR
.fi
.PP
To retrieve the files back from S3 use inverted syntax:
.nf
s3cmd sync s3://test\-bucket/backup/ ~/restore/
.fi
that will download files:
.nf
s3://bucket/backup/\fBfile1.ext\fR \-> ~/restore/\fBfile1.ext\fR
s3://bucket/backup/\fBdir123/file2.bin\fR \-> ~/restore/\fBdir123/file2.bin\fR
.fi
.PP
Without the trailing slash on source the behaviour is similar to
what has been demonstrated with upload:
.nf
s3cmd sync s3://test\-bucket/backup ~/restore/
.fi
will download the files as:
.nf
s3://bucket/\fBbackup/file1.ext\fR \-> ~/restore/\fBbackup/file1.ext\fR
s3://bucket/\fBbackup/dir123/file2.bin\fR \-> ~/restore/\fBbackup/dir123/file2.bin\fR
.fi
.PP
All source file names, the bold ones above, are matched against \fBexclude\fR
rules and those that match are then re\-checked against \fBinclude\fR rules to see
whether they should be excluded or kept in the source list.
.PP
For the purpose of \fB\-\-exclude\fR and \fB\-\-include\fR matching only the
bold file names above are used. For instance only \fBpath/file1.ext\fR is tested
against the patterns, not \fI/local/\fBpath/file1.ext\fR
.PP
Both \fB\-\-exclude\fR and \fB\-\-include\fR work with shell\-style wildcards (a.k.a. GLOB).
For a greater flexibility s3cmd provides Regular\-expression versions of the two exclude options
named \fB\-\-rexclude\fR and \fB\-\-rinclude\fR.
The options with ...\fB\-from\fR suffix (eg \-\-rinclude\-from) expect a filename as
an argument. Each line of such a file is treated as one pattern.
.PP
There is only one set of patterns built from all \fB\-\-(r)exclude(\-from)\fR options
and similarly for include variant. Any file excluded with eg \-\-exclude can
be put back with a pattern found in \-\-rinclude\-from list.
.PP
Run s3cmd with \fB\-\-dry\-run\fR to verify that your rules work as expected.
Use together with \fB\-\-debug\fR get detailed information
about matching file names against exclude and include rules.
.PP
For example to exclude all files with ".jpg" extension except those beginning with a number use:
.PP
\-\-exclude '*.jpg' \-\-rinclude '[0\-9].*\.jpg'
.PP
To exclude all files except "*.jpg" extension, use:
.PP
\-\-exclude '*' \-\-include '*.jpg'
.PP
To exclude local directory 'somedir', be sure to use a trailing forward slash, as such:
.PP
\-\-exclude 'somedir/'
.PP
.SH SEE ALSO
For the most up to date list of options run:
.B s3cmd \-\-help
.br
For more info about usage, examples and other related info visit project homepage at:
.B http://s3tools.org
.SH AUTHOR
Written by Michal Ludvig and contributors
.SH CONTACT, SUPPORT
Preferred way to get support is our mailing list:
.br
.I s3tools\[email protected]
.br
or visit the project homepage:
.br
.B http://s3tools.org
.SH REPORTING BUGS
Report bugs to
.I s3tools\[email protected]
.SH COPYRIGHT
Copyright \(co 2007\-2015 TGRMN Software \- http://www.tgrmn.com \- and contributors
.br
.SH LICENSE
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.br