Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 186 lines (175 sloc) 5.944 kB
593ef06 @mludvig * format-manpage.pl: new manpage auto-formatter
mludvig authored
1 #!/usr/bin/perl
2
3 # Format s3cmd.1 manpage
4 # Usage:
5 # s3cmd --help | format-manpage.pl > s3cmd.1
6
7 use strict;
8
9 my $commands = "";
10 my $cfcommands = "";
11 my $options = "";
12
13 while (<>) {
14 if (/^Commands:/) {
15 while (<>) {
16 last if (/^\s*$/);
17 my ($desc, $cmd, $cmdline);
18 ($desc = $_) =~ s/^\s*(.*?)\s*$/$1/;
19 ($cmdline = <>) =~ s/^\s*s3cmd (.*?) (.*?)\s*$/s3cmd \\fB$1\\fR \\fI$2\\fR/;
20 $cmd = $1;
21 if ($cmd =~ /^cf/) {
22 $cfcommands .= ".TP\n$cmdline\n$desc\n";
23 } else {
24 $commands .= ".TP\n$cmdline\n$desc\n";
25 }
26 }
27 }
28 if (/^Options:/) {
29 my ($opt, $desc);
30 while (<>) {
31 last if (/^\s*$/);
32 $_ =~ s/\s*(.*?)\s*$/$1/;
33 $desc = "";
34 $opt = "";
35 if (/^(-.*)/) {
36 $opt = $1;
37 if ($opt =~ / /) {
38 ($opt, $desc) = split(/\s\s+/, $opt, 2);
39 }
40 $opt =~ s/(-[^ ,=]+)/\\fB$1\\fR/g;
41 $opt =~ s/-/\\-/g;
42 $options .= ".TP\n$opt\n";
43 } else {
44 $desc .= $_;
45 }
46 if ($desc) {
47 $options .= "$desc\n";
48 }
49 }
50 }
51 }
52 print "
53 .TH s3cmd 1
54 .SH NAME
55 s3cmd \\- tool for managing Amazon S3 storage space and Amazon CloudFront content delivery network
56 .SH SYNOPSIS
57 .B s3cmd
58 [\\fIOPTIONS\\fR] \\fICOMMAND\\fR [\\fIPARAMETERS\\fR]
59 .SH DESCRIPTION
60 .PP
61 .B s3cmd
62 is a command line client for copying files to/from
63 Amazon S3 (Simple Storage Service) and performing other
64 related tasks, for instance creating and removing buckets,
65 listing objects, etc.
66
67 .SH COMMANDS
68 .PP
69 .B s3cmd
70 can do several \\fIactions\\fR specified by the following \\fIcommands\\fR.
71 $commands
72
73 .PP
74 Commands for CloudFront management
75 $cfcommands
76
77 .SH OPTIONS
78 .PP
79 Some of the below specified options can have their default
80 values set in
81 .B s3cmd
82 config file (by default \$HOME/.s3cmd). As it's a simple text file
83 feel free to open it with your favorite text editor and do any
84 changes you like.
85 $options
86
87 .SH EXAMPLES
88 One of the most powerful commands of \\fIs3cmd\\fR is \\fBs3cmd sync\\fR used for
89 synchronising complete directory trees to or from remote S3 storage. To some extent
90 \\fBs3cmd put\\fR and \\fBs3cmd get\\fR share a similar behaviour with \\fBsync\\fR.
91 .PP
92 Basic usage common in backup scenarios is as simple as:
93 .nf
94 s3cmd sync /local/path/ s3://test-bucket/backup/
95 .fi
96 .PP
97 This command will find all files under /local/path directory and copy them
98 to corresponding paths under s3://test-bucket/backup on the remote side.
99 For example:
100 .nf
101 /local/path/\\fBfile1.ext\\fR \\-> s3://bucket/backup/\\fBfile1.ext\\fR
102 /local/path/\\fBdir123/file2.bin\\fR \\-> s3://bucket/backup/\\fBdir123/file2.bin\\fR
103 .fi
104 .PP
105 However if the local path doesn't end with a slash the last directory's name
106 is used on the remote side as well. Compare these with the previous example:
107 .nf
108 s3cmd sync /local/path s3://test-bucket/backup/
109 .fi
110 will sync:
111 .nf
112 /local/\\fBpath/file1.ext\\fR \\-> s3://bucket/backup/\\fBpath/file1.ext\\fR
113 /local/\\fBpath/dir123/file2.bin\\fR \\-> s3://bucket/backup/\\fBpath/dir123/file2.bin\\fR
114 .fi
115 .PP
116 To retrieve the files back from S3 use inverted syntax:
117 .nf
118 s3cmd sync s3://test-bucket/backup/ /tmp/restore/
119 .fi
120 that will download files:
121 .nf
122 s3://bucket/backup/\\fBfile1.ext\\fR \\-> /tmp/restore/\\fBfile1.ext\\fR
123 s3://bucket/backup/\\fBdir123/file2.bin\\fR \\-> /tmp/restore/\\fBdir123/file2.bin\\fR
124 .fi
125 .PP
126 Without the trailing slash on source the behaviour is similar to
127 what has been demonstrated with upload:
128 .nf
129 s3cmd sync s3://test-bucket/backup /tmp/restore/
130 .fi
131 will download the files as:
132 .nf
133 s3://bucket/\\fBbackup/file1.ext\\fR \\-> /tmp/restore/\\fBbackup/file1.ext\\fR
134 s3://bucket/\\fBbackup/dir123/file2.bin\\fR \\-> /tmp/restore/\\fBbackup/dir123/file2.bin\\fR
135 .fi
136 .PP
137 All source file names, the bold ones above, are matched against \\fBexclude\\fR
138 rules and those that match are then re\\-checked against \\fBinclude\\fR rules to see
139 whether they should be excluded or kept in the source list.
140 .PP
141 For the purpose of \\fB\\-\\-exclude\\fR and \\fB\\-\\-include\\fR matching only the
142 bold file names above are used. For instance only \\fBpath/file1.ext\\fR is tested
143 against the patterns, not \\fI/local/\\fBpath/file1.ext\\fR
144 .PP
145 Both \\fB\\-\\-exclude\\fR and \\fB\\-\\-include\\fR work with shell-style wildcards (a.k.a. GLOB).
146 For a greater flexibility s3cmd provides Regular-expression versions of the two exclude options
147 named \\fB\\-\\-rexclude\\fR and \\fB\\-\\-rinclude\\fR.
148 The options with ...\\fB\\-from\\fR suffix (eg \\-\\-rinclude\\-from) expect a filename as
149 an argument. Each line of such a file is treated as one pattern.
150 .PP
151 There is only one set of patterns built from all \\fB\\-\\-(r)exclude(\\-from)\\fR options
152 and similarly for include variant. Any file excluded with eg \\-\\-exclude can
153 be put back with a pattern found in \\-\\-rinclude\\-from list.
154 .PP
155 Run s3cmd with \\fB\\-\\-dry\\-run\\fR to verify that your rules work as expected.
156 Use together with \\fB\\-\\-debug\\fR get detailed information
157 about matching file names against exclude and include rules.
158 .PP
159 For example to exclude all files with \".jpg\" extension except those beginning with a number use:
160 .PP
161 \\-\\-exclude '*.jpg' \\-\\-rinclude '[0-9].*\\.jpg'
162
163 .SH SEE ALSO
164 For the most up to date list of options run
165 .B s3cmd \\-\\-help
166 .br
167 For more info about usage, examples and other related info visit project homepage at
168 .br
169 .B http://s3tools.org
170
171 .SH AUTHOR
172 Written by Michal Ludvig <mludvig\@logix.net.nz>
173 .SH CONTACT, SUPPORT
174 Prefered way to get support is our mailing list:
175 .I s3tools\\-general\@lists.sourceforge.net
176 .SH REPORTING BUGS
177 Report bugs to
178 .I s3tools\\-bugs\@lists.sourceforge.net
179 .SH COPYRIGHT
180 Copyright \\(co 2007,2008,2009,2010 Michal Ludvig <http://www.logix.cz/michal>
181 .br
182 This is free software. You may redistribute copies of it under the terms of
183 the GNU General Public License version 2 <http://www.gnu.org/licenses/gpl.html>.
184 There is NO WARRANTY, to the extent permitted by law.
185 ";
Something went wrong with that request. Please try again.