bin/dbox in dbox-0.8.2 vs bin/dbox in dbox-0.8.3
- old
+ new
@@ -1,20 +1,22 @@
#!/usr/bin/env ruby
$:.unshift File.expand_path(File.join(File.dirname(__FILE__), "..", "lib"))
require "dbox"
+require "json"
# usage line
def usage
<<_EOF
Usage: dbox <command> [<args>]
Commands:
authorize Generate auth keys
create <remote_path> [<local_path>] Create a new Dropbox folder
+ list <remote_path> List files and directories in Dropbox folder
clone <remote_path> [<local_path>] Clone an existing Dropbox folder
- pull [<local_path>] Pull chonges from Dropbox
+ pull [<local_path>] Pull changes from Dropbox
push [<local_path>] Push changes to Dropbox
sync [<local_path>] Sync changes to Dropbox
move <new_remote_path> [<local_path>] Move the remote Dropbox folder to a new location
delete <remote_path> [<local_path>] Delete a Dropbox folder (local path optional, it will be deleted too if provided)
clone_or_pull <remote_path> [<local_path>] Clone an existing Dropbox folder, or pull if it already exists locally
@@ -91,8 +93,14 @@
Dbox.send(command, remote_path, local_path)
when "metadata"
remote_path = args[0]
res = Dbox.metadata(remote_path)
puts res.inspect
+when "list"
+ remote_path = args[0]
+ files = Dbox.metadata(remote_path)
+ files['contents'].each do |file|
+ puts file['path'][/[^\/]+$/]
+ end
else
print_usage_and_quit
end