dbxcli

使用 Go SDK 构建的 Dropbox 命令行客户端。(A command line client for Dropbox built using the Go SDK)

Github stars Tracking Chart

dbxcli:一个为 Dropbox 用户和团队管理员提供的命令行工具

特性

  • 支持基本的文件操作,如 ls、cp、mkdir、mv(通过 Files API)。
  • 支持搜索
  • 支持文件修改和文件恢复
  • 大文件的分块上传,大目录的分页列表。
  • 支持不断增长的团队业务

安装

发布 页面下载 Mac、Windows 和 Linux 的预编译二进制文件。

Mac OSX 安装预编译的二进制文件

这些说明旨在帮助专家和新手用户。如果这些说明对你不起作用,请提交问题。

  1. 确保你下载了二进制文件,并将其放在你的 $PATH 上的文件夹中。如果您不确定这意味着什么,请转到第2步。否则,请跳到第3步
  2. 在你的主目录下创建一个bin目录。

$ mkdir ~/bin
$ cd ~/bin

  1. 在 ~/.bash_profile 文件的末尾添加以下一行。关于如何找到这个文件的说明链接
export PATH=$PATH:$HOME/bin
  1. 下载适用于 OSX 的 dbxcli 二进制文件并重新命名。重要:请检查以下 URL 上的标签 v2.1.1 是否为 发布 页面上的最新版本标签。
$ wget https://github.com/dropbox/dbxcli/releases/download/v2.1.1/dbxcli-darwin-amd64 
$ mv dbxcli-darwin-amd64 dbxcli
  1. 最后,把二进制文件做成可执行文件,就可以了。
$ chmod +x dbxcli

自行构建说明

对于新手来说,go 的构建过程可能有点玄乎,可以按照这些步骤自己构建 dbxcli。

  1. 确保安装了 git、go 和 gox。
  2. 创建一个 Go 文件夹。例如,mkdir $HOME/go 或 mkdir $HOME/.go。导航到它。
  3. go get github.com/dropbox/dbxcli。没错,你不需要手动克隆它,这就帮你完成了。
  4. cd ~/go/src/github.com/dropbox/dbxcli(根据第2步进行相应调整)。

现在我们需要暂停一下,获取开发密钥。

  1. 前往 https://www.dropbox.com/developers/apps(必要时登录),选择 "创建应用"。使用 Dropbox API,并给它完整的 Dropbox 访问权限。命名并创建应用程序。
  2. 你会看到一个仪表板,上面有一个 "App Key" 和一个 "App secret"。
  3. 用网页上的密钥替换 root.go 中 personalAppKey 的值。
  4. 用网页上的秘密替换 personalAppSecret 的值。

最后,我们准备好构建了。运行 go build,你会看到一个 dbxcli 二进制文件已经在当前目录下创建。恭喜你,我们完成了

使用方法

dbxcli 在很大程度上是自文档化的。运行 dbxcli -h 查看支持的命令列表。

$ dbxcli --help
Use dbxcli to quickly interact with your Dropbox, upload/download files,
manage your team and more. It is easy, scriptable and works on all platforms!
Usage:
  dbxcli [command]
Available Commands:
  cp          Copy files
  du          Display usage information
  get         Download a file
  ls          List files
  mkdir       Create a new directory
  mv          Move files
  put         Upload files
  restore     Restore files
  revs        List file revisions
  rm          Remove files
  search      Search
  team        Team management commands
  version     Print version information
Flags:
      --as-member string   Member ID to perform action as
  -v, --verbose            Enable verbose logging
Use "dbxcli [command] --help" for more information about a command.
$ dbxcli team --help
Team management commands
Usage:
  dbxcli team [command]
Available Commands:
  add-member    Add a new member to a team
  info          Get team information
  list-groups   List groups
  list-members  List team members
  remove-member Remove member from a team
Global Flags:
      --as-member string   Member ID to perform action as
  -v, --verbose            Enable verbose logging
Use "dbxcli team [command] --help" for more information about a command.

--verbose选项将开启详细的日志记录,对调试很有用。

我们需要您的帮助

dbxcli 正在积极开发中。正如您从 API 文档 中看到的那样,我们目前只支持少量的功能,而且只是对可能的功能进行了简单的介绍。我们希望您,我们的用户,能够提供反馈,以指导我们下一步的开发和如何改进这个工具。

所以,请提交功能请求,报告错误,或者更好的是,给我们发送拉取请求。下面是更多关于贡献的内容。

贡献

有用的资源


Main metrics

Overview
Name With Ownerdropbox/dbxcli
Primary LanguageGo
Program languageGo (Language Count: 2)
PlatformBSD, Linux, Mac, Windows
License:Other
所有者活动
Created At2016-01-25 18:11:34
Pushed At2024-06-27 21:07:39
Last Commit At2023-03-06 10:01:19
Release Count26
Last Release Namev3.0.0 (Posted on )
First Release Namev0.1.0 (Posted on )
用户参与
Stargazers Count1.1k
Watchers Count36
Fork Count98
Commits Count265
Has Issues Enabled
Issues Count142
Issue Open Count85
Pull Requests Count43
Pull Requests Open Count16
Pull Requests Close Count13
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private

dbxcli: A command line tool for Dropbox users and team admins

Build Status
Go Report Card

Features

  • Supports basic file operations like ls, cp, mkdir, mv (via the Files API)
  • Supports search
  • Supports file revisions and file restore
  • Chunked uploads for large files, paginated listing for large directories
  • Supports a growing set of Team operations

Installation

Download pre-compiled binaries for Mac, Windows and Linux from the releases page.

Mac OSX Installation of pre-compiled binaries

These instructions aim to help both experts and novice dbxcli users. Please submit an issue if they don't work for you.

  1. Make sure you download and place the binary in a folder that's on your $PATH. If you are unsure what this means, go to step 2. Otherwise, skip to step 3
  2. Create a bin directory under your home directory.
$ mkdir ~/bin
$ cd ~/bin
  1. Add the following line at the end of your ~/.bash_profile file. Link with instructions on how to find this file
export PATH=$PATH:$HOME/bin
  1. Download the dbxcli binary for OSX and rename it. IMPORTANT: Check that the tag v2.1.1 on the URL below is the latest release tag on the Releases page.
$ wget https://github.com/dropbox/dbxcli/releases/download/v2.1.1/dbxcli-darwin-amd64 
$ mv dbxcli-darwin-amd64 dbxcli
  1. Finally, make the binary an executable file and you are good to go!
$ chmod +x dbxcli

Instructions for building yourself

For newcomers the go build process can be a bit arcane, these steps can be followed to build dbxcli yourself.

  1. Make sure git, go, and gox are installed.
  2. Create a Go folder. For example, mkdir $HOME/go or mkdir $HOME/.go. Navigate to it.
  3. go get github.com/dropbox/dbxcli. That's right, you don't manually clone it, this does it for you.
  4. cd ~/go/src/github.com/dropbox/dbxcli (adapt accordingly based on step 2).

Now we need to pause for a second to get development keys.

  1. Head to https://www.dropbox.com/developers/apps (sign in if necessary) and choose "Create app". Use the Dropbox API and give it Full Dropbox access. Name and create the app.
  2. You'll be presented with a dashboard with an "App key" and an "App secret".
  3. Replace the value for personalAppKey in root.go with the key from the webpage.
  4. Replace the value for personalAppSecret with the secret from the webpage.

Finally we're ready to build. Run go build, and you'll see a dbxcli binary has been created in the current directory. Congrats, we're done!

Usage

dbxcli is largely self documenting. Run dbxcli -h for a list of supported commands:

$ dbxcli --help
Use dbxcli to quickly interact with your Dropbox, upload/download files,
manage your team and more. It is easy, scriptable and works on all platforms!

Usage:
  dbxcli [command]

Available Commands:
  cp          Copy files
  du          Display usage information
  get         Download a file
  ls          List files
  mkdir       Create a new directory
  mv          Move files
  put         Upload files
  restore     Restore files
  revs        List file revisions
  rm          Remove files
  search      Search
  team        Team management commands
  version     Print version information

Flags:
      --as-member string   Member ID to perform action as
  -v, --verbose            Enable verbose logging

Use "dbxcli [command] --help" for more information about a command.

$ dbxcli team --help
Team management commands

Usage:
  dbxcli team [command]

Available Commands:
  add-member    Add a new member to a team
  info          Get team information
  list-groups   List groups
  list-members  List team members
  remove-member Remove member from a team

Global Flags:
      --as-member string   Member ID to perform action as
  -v, --verbose            Enable verbose logging

Use "dbxcli team [command] --help" for more information about a command.

The --verbose option will turn on verbose logging and is useful for debugging.

We need your help!

dbxcli is under active development! As you can see from the API docs, we only support a small number of features today and have only scratched the surface of what's possible. We would love feedback from you, our users, to guide what to build next and how to improve the tool.

So please, file feature requests, report bugs or better yet, send us pull requests! More on contributing below.

Contributing

Useful Resources