boxcli is written in Python with Click and Box SDK.
$ git clone https://github.com/xuwang/boxcli
$ cd boxcli
Using python virtualenv is highly recommended.
# Install virtualenv if not already installed
$ sudo pip install virtualenv
# Create project venv
$ virtualenv venv
# Activate project venv whenever you want to work the project
$ . venv/bin/activate
# And if you want to go back to the real world:
$ deactivate
$ pip install --editable .
-
Create and Config a new Box App by following instructions on This Doc
-
Config JWT Authentication by following instructions on This Doc
-
Set following values in env.sh:
export BOX_CLIENT_ID= export BOX_CLIENT_SECRET= export BOX_ENTERPRISE_ID= export BOX_JWT_KEY_ID= export BOX_PRIVATE_KEY_FILE= export BOX_DEFAULT_APP_USER_NAME=
boxcli handles box resources, i.e. folders/files, on behalf of a "box app user" as documented in Creating Your First App User:
$ source env.sh
$ boxcli user create "${BOX_DEFAULT_APP_USER_NAME}"
This is the default app user when you manange folder/files in Box.
$ boxcli folder list
$ boxcli folder create myfiles
$ boxcli folder delete myfiles
Warning: All items under myfiles will be deleted recursively!
$ boxcli file list
$ boxcli file upload README.md
$ boxcli file download README.md
$ boxcli file update README.md
$ boxcli file delete README.md
$ boxcli --help
Usage: boxcli [OPTIONS] COMMAND [ARGS]...
box command line tool
Options:
--help Show this message and exit.
Commands:
file sub-commands for manage box files.
folder sub-commands for manage box folders.
user sub-commands for manage box app users.
...
$ boxcli folder --help
Usage: boxcli folder [OPTIONS] COMMAND [ARGS]...
sub-commands for manage box folders.
Options:
--help Show this message and exit.
Commands:
create Create a folder.
delete Delete a folder.
get Get a folder attributes by path.
list List items in a folder.
...