1App::dropboxapi(3pm) User Contributed Perl Documentation App::dropboxapi(3pm)
2
3
4
6 App::dropboxapi - command line interface to access Dropbox API
7
9 dropbox-api put /tmp/foo.txt dropbox:/Public/
10
11 Run "dropbox-api help" for more options.
12
14 dropbox-api is a command line interface to access Dropbox API.
15
16 ls
17 find
18 du
19 sync
20 cp
21 mv
22 rm
23 mkdir
24 get
25 put
26
28 1. Install
29 1-a) FreeBSD
30
31 pkg_add -r dropbox-api-command
32
33 1-b) Ubuntu
34
35 sudo apt-get install make gcc libssl-dev wget
36 wget https://raw.github.com/miyagawa/cpanminus/master/cpanm
37 sudo perl cpanm App::dropboxapi
38
39 1-c) CentOS
40
41 # CentOS 5
42 sudo yum install gcc gcc-c++ openssl-devel wget
43 # CentOS 6
44 sudo yum install gcc gcc-c++ openssl-devel wget perl-devel
45 wget https://raw.github.com/miyagawa/cpanminus/master/cpanm
46 sudo perl cpanm App::dropboxapi
47
48 1-d) OS X
49
50 # Install Command Line Tools for Xcode
51 open https://www.google.com/search?q=Command+Line+Tools+for+Xcode
52
53 curl -O https://raw.github.com/miyagawa/cpanminus/master/cpanm
54 sudo perl cpanm App::dropboxapi
55
56 2. Get API Key and API Secret
57 https://www.dropbox.com/developers
58 My Apps => Create an App
59
60 3. Get Access Token and Access Secret
61 > dropbox-api setup
62 Please Input API Key: ***************
63 Please Input API Secret: ***************
64 1. Open the Login URL: https://www.dropbox.com/oauth2/authorize?client_id=*****&response_type=code
65 2. Input code and press Enter: ***************
66 success! try
67 > dropbox-api ls
68 > dropbox-api find /
69
70 4. How to use Proxy
71 Please use -e option.
72
73 > HTTP_PROXY="http://127.0.0.1:8888" dropbox-api setup -e
74
76 help
77 disp help.
78
79 syntax
80 dropbox-api help [<command>]
81
82 Example
83
84 > dropbox-api help
85 Usage: dropbox-api <command> [args] [options]
86
87 Available commands:
88 setup get access_key and access_secret
89 ls list directory contents
90 find walk a file hierarchy
91 du disk usage statistics
92 cp copy file or directory
93 mv move file or directory
94 mkdir make directory (Create intermediate directories as required)
95 rm remove file or directory (Attempt to remove the file hierarchy rooted in each file argument)
96 put upload file
97 get download file
98 sync sync directory (local => dropbox or dropbox => local)
99
100 Common Options
101 -e enable env_proxy ( HTTP_PROXY, NO_PROXY )
102 -D enable debug
103 -v verbose
104 -s sandbox mode, but this option has been removed.
105
106 See 'dropbox-api help <command>' for more information on a specific command.
107
108 Example ( command help )
109
110 > dropbox-api help ls
111 Name
112 dropbox-api-ls - list directory contents
113
114 SYNOPSIS
115 dropbox-api ls <dropbox_path> [options]
116
117 Example
118 dropbox-api ls Public
119 dropbox-api ls Public -h
120 dropbox-api ls Public -p "%d\t%s\t%TY/%Tm/%Td %TH:%TM:%TS\t%p\n"
121
122 Options
123 -h print sizes in human readable format (e.g., 1K 234M 2G)
124 -p print format.
125 %d ... is_dir ( d: dir, -: file )
126 %i ... id
127 %n ... name
128 %p ... path_display
129 %P ... path_lower
130 %b ... bytes
131 %s ... size (e.g., 1K 234M 2G)
132 %t ... server_modified
133 %c ... client_modified
134 %r ... rev
135 %Tk ... DateTime 'strftime' function (server_modified)
136 %Ck ... DateTime 'strftime' function (client_modified)
137
138 <http://search.cpan.org/dist/DateTime/lib/DateTime.pm#strftime_Patterns>
139
140 ls
141 file list view.
142
143 alias
144 list
145
146 syntax
147 dropbox-api ls <dropbox_path>
148
149 Example
150
151 > dropbox-api list /product
152 d - Thu, 24 Feb 2011 06:58:00 +0000 /product/chrome-extentions
153 - 294557 Sun, 26 Dec 2010 21:55:59 +0000 /product/ex.zip
154
155 human readable option ( -h )
156
157 print sizes in human readable format (e.g., 1K 234M 2G)
158
159 > dropbox-api ls /product -h
160 d - Thu, 24 Feb 2011 06:58:00 +0000 /product/chrome-extentions
161 - 287.7KB Sun, 26 Dec 2010 21:55:59 +0000 /product/ex.zip
162
163 printf option ( -p )
164
165 print format.
166
167 > dropbox-api ls /product -p "%d\t%s\t%TY/%Tm/%Td %TH:%TM:%TS\t%p\n"
168 d - 2011/02/24 06:58:00 /product/chrome-extentions
169 - 287.7KB 2010/12/26 21:55:59 /product/ex.zip
170
171 %d ... is_dir ( d: dir, -: file )
172 %i ... id
173 %n ... name
174 %p ... path_display
175 %P ... path_lower
176 %b ... bytes
177 %s ... size (e.g., 1K 234M 2G)
178 %t ... server_modified
179 %c ... client_modified
180 %r ... rev
181 %Tk ... DateTime 'strftime' function (server_modified)
182 %Ck ... DateTime 'strftime' function (client_modified)
183
184 <http://search.cpan.org/dist/DateTime/lib/DateTime.pm#strftime_Patterns>
185
186 find
187 recursive file list view.
188
189 syntax
190 dropbox-api find <dropbox_path> [options]
191
192 Example
193
194 > dropbox-api find /product/google-tasks-checker-plus
195 /product/chrome-extentions/google-tasks-checker-plus/README.md
196 /product/chrome-extentions/google-tasks-checker-plus/src
197 /product/chrome-extentions/google-tasks-checker-plus/src/background.html
198 /product/chrome-extentions/google-tasks-checker-plus/src/external.png
199 /product/chrome-extentions/google-tasks-checker-plus/src/icon-32.png
200 /product/chrome-extentions/google-tasks-checker-plus/src/icon-128.png
201 /product/chrome-extentions/google-tasks-checker-plus/src/icon.gif
202 /product/chrome-extentions/google-tasks-checker-plus/src/jquery-1.4.2.min.js
203 /product/chrome-extentions/google-tasks-checker-plus/src/main.js
204 /product/chrome-extentions/google-tasks-checker-plus/src/manifest.json
205 /product/chrome-extentions/google-tasks-checker-plus/src/options.html
206 /product/chrome-extentions/google-tasks-checker-plus/src/popup.html
207 /product/chrome-extentions/google-tasks-checker-plus/src/reset.css
208
209 printf option ( -p )
210
211 see also list command's printf option.
212
213 du
214 display disk usage statistics.
215
216 syntax
217 dropbox-api du <dropbox_path> [options]
218
219 Example
220
221 > dropbox-api du /product -h -d 1
222 1.1M /product
223 1.1M /product/chrome-extensions
224 0B /product/work
225
226 human readable option ( -h )
227
228 print sizes in human readable format (e.g., 1K 234M 2G)
229
230 depth option ( -d )
231
232 Display an entry for all files and directories depth directories deep.
233
234 sync ( rsync )
235 recursive file synchronization.
236
237 sync from dropbox
238
239 dropbox-api sync dropbox:<source_dir> <target_dir> [options]
240
241 > dropbox-api sync dropbox:/product/google-tasks-checker-plus/src /tmp/product
242 download /private/tmp/product/external.png
243 download /private/tmp/product/icon-32.png
244 download /private/tmp/product/icon-128.png
245
246 sync to dropbox
247
248 dropbox-api sync <source_dir> dropbox:<target_dir> [options]
249
250 > dropbox-api sync /tmp/product dropbox:/work/src
251 upload background.html /work/src/background.html
252 upload external.png /work/src/external.png
253 upload icon-128.png /work/src/icon-128.png
254
255 delete option ( -d )
256
257 > dropbox-api sync dropbox:/product/google-tasks-checker-plus/src /tmp/product -d
258 download /private/tmp/product/external.png
259 download /private/tmp/product/icon-32.png
260 download /private/tmp/product/icon-128.png
261 remove background.html.tmp
262
263 dry run option ( -n )
264
265 > dropbox-api sync dropbox:/product/google-tasks-checker-plus/src /tmp/product -dn
266 !! enable dry run !!
267 download /private/tmp/product/external.png
268 download /private/tmp/product/icon-32.png
269 download /private/tmp/product/icon-128.png
270 remove background.html.tmp
271
272 verbose option ( -v )
273
274 > dropbox-api sync dropbox:/product/google-tasks-checker-plus/src /tmp/product -dnv
275 remote_base: /product/chrome-extentions/google-tasks-checker-plus/src
276 local_base: /private/tmp/product
277 ** download **
278 skip background.html
279 download /private/tmp/product/external.png
280 download /private/tmp/product/icon-32.png
281 download /private/tmp/product/icon-128.png
282 skip icon.gif
283 skip jquery-1.4.2.min.js
284 skip main.js
285 skip manifest.json
286 skip options.html
287 skip popup.html
288 skip reset.css
289 ** delete **
290 skip background.html
291 remove background.html.tmp
292 skip icon.gif
293 skip jquery-1.4.2.min.js
294 skip main.js
295 skip manifest.json
296 skip options.html
297 skip popup.html
298 skip reset.css
299
300 cp
301 copy file or directory.
302
303 alias
304 copy
305
306 syntax
307 dropbox-api cp <source_file> <target_file>
308
309 Example
310
311 dropbox-api cp memo.txt memo.txt.bak
312
313 mv
314 move file or directory.
315
316 alias
317 move
318
319 syntax
320 dropbox-api mv <source_file> <target_file>
321
322 Example
323
324 dropbox-api mv memo.txt memo.txt.bak
325
326 mkdir
327 make directory.
328
329 *no error if existing, make parent directories as needed.*
330
331 alias
332 mkpath
333
334 syntax
335 dropbox-api mkdir <directory>
336
337 Example
338
339 dropbox-api mkdir product/src
340
341 rm
342 remove file or directory.
343
344 *remove the contents of directories recursively.*
345
346 alias
347 rmtree
348
349 syntax
350 dropbox-api rm <file_or_directory>
351
352 Example
353
354 dropbox-api rm product/src
355
356 get
357 download file from dropbox.
358
359 alias
360 dl, download
361
362 syntax
363 dropbox-api get dropbox:<dropbox_file> <file>
364
365 Example
366
367 dropbox-api get dropbox:/Public/foo.txt /tmp/foo.txt
368
369 put
370 upload file to dropbox.
371
372 alias
373 up, upload
374
375 syntax
376 dropbox-api put <file> dropbox:<dropbox_dir>
377
378 Example
379
380 dropbox-api put /tmp/foo.txt dropbox:/Public/
381
382 verbose option ( -v )
383
384 A progress bar is displayed.
385
386 dropbox-api put /tmp/1GB.dat dropbox:/Public/ -v
387 100% [=====================================================================================>]
388
389 Tips
390 Retry
391
392 #!/bin/bash
393
394 command='dropbox-api sync dropbox:/test/ /Users/aska/test/ -vde'
395
396 NEXT_WAIT_TIME=0
397 EXIT_CODE=0
398 until $command || [ $NEXT_WAIT_TIME -eq 4 ]; do
399 EXIT_CODE=$?
400 sleep $NEXT_WAIT_TIME
401 let NEXT_WAIT_TIME=NEXT_WAIT_TIME+1
402 done
403 exit $EXIT_CODE
404
406 Copyright 2012- Shinichiro Aska
407
408 The standalone executable contains the following modules embedded.
409
411 Released under the MIT license.
412 http://creativecommons.org/licenses/MIT/
413
415 <https://github.com/s-aska/dropbox-api-command> - source code
416 repository, issue tracker
417
418
419
420perl v5.32.0 2020-07-27 App::dropboxapi(3pm)