Transfer files with Box and lftp
Outline
Purpose
Transfer Box cloud storage files with the command line tool lftp. lftp is more reliable than using a web browser. It automatically handles errors, can restart interrupted transfers, and can transfer both large files and large amounts of files. lftp is also useful when there is no GUI available such as in an HPC environment.
Setup and Configuration
First install lftp on your local machine with your favorite package manager:
$ brew install lftp
Then update the lftp config file to force strict security options.
$ mkdir ~/.lftp
$ echo -e \
'set ftps:initial-prot ""
set ftp:ssl-force true
set ftp:ssl-protect-data true' >> ~/.lftp/rc
If your Box account uses SSO you must create a unique password to use lftp. Most university Box accounts use SSO. Set a unique password from your Box account settings.
 
 Using lftp 
 Login with your Box unique password and start an lftp shell with the command below. Replace [Box email address] with the “Default Email Address” shown in your Box account settings.
$ lftp ftps://[Box email address]@ftp.box.com
Upload a local directory to Box (defaults to top-level Box directory without second path)
lftp foo@ftp.box.com:~> mirror -R /path/to/local/directory /path/to/Box/directory
Download a Box directory to your local machine
lftp foo@ftp.box.com:~> mirror /path/to/Box/directory /path/to/local/directory
Upload a local file to Box (defaults to top-level Box directory without -o flag and argument)
lftp foo@ftp.box.com:~> put /path/to/local.file -o /path/to/Box/directory
Download a Box file to your local machine (defaults to local $HOME directory without -o flag and argument)
lftp foo@ftp.box.com:~> get /path/to/Box.file -o /path/to/local/directory
Some more useful lftp shell commands:
| Command | Description | |||
| ls | list files in current Box directory | |||
| !ls | list files in current local directory | |||
| cd | change Box directory | |||
| lcd | change local directory | |||
| pwd | print path to current Box directory | |||
| lpwd | print path to current local directory | |||
| mkdir | make a folder on Box | 
 Check out this page or run man lftp in your terminal for a comprehensive list of commands and options. This tutorial borrows heavily from the lftp guide from the Barrick Lab .