Giter VIP home page Giter VIP logo

cfcboy / dropbox-uploader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from andreafabrizi/dropbox-uploader

0.0 1.0 0.0 283 KB

Dropbox Uploader is a BASH script which can be used to upload, download, list or delete files from Dropbox, an online file sharing, synchronization and backup service.

Home Page: http://www.andreafabrizi.it/?dropbox_uploader

License: GNU General Public License v3.0

Shell 100.00%

dropbox-uploader's Introduction

Dropbox Uploader

Dropbox Uploader is a BASH script which can be used to upload, download, delete, list files (and more!) from Dropbox, an online file sharing, synchronization and backup service.

It's written in BASH scripting language and only needs cURL.

Why use this script?

  • Portable: It's written in BASH scripting and only needs cURL (curl is a tool to transfer data from or to a server, available for all operating systems and installed by default in many linux distributions).
  • Secure: It's not required to provide your username/password to this script, because it uses the official Dropbox API for the authentication process.

Please refer to the <Wiki>(https://github.com/andreafabrizi/Dropbox-Uploader/wiki) for tips and additional information about this project. The Wiki is also the place where you can share your scripts and examples related to Dropbox Uploader.

Features

  • Cross platform
  • Support for the official Dropbox API
  • No password required or stored
  • Simple step-by-step configuration wizard
  • Simple and chunked file upload
  • File and recursive directory download
  • File and recursive directory upload
  • Shell wildcard expansion (only for upload)
  • Delete/Move/Rename/Copy/List files
  • Create share link

Getting started

First, clone the repository using git (recommended):

git clone https://github.com/andreafabrizi/Dropbox-Uploader/

or download the script manually using this command:

curl "https://raw.githubusercontent.com/andreafabrizi/Dropbox-Uploader/master/dropbox_uploader.sh" -o dropbox_uploader.sh

Then give the execution permission to the script and run it:

 $chmod +x dropbox_uploader.sh
 $./dropbox_uploader.sh

The first time you run dropbox_uploader, you'll be guided through a wizard in order to configure access to your Dropbox. This configuration will be stored in ~/.dropbox_uploader.

Configuration wizard

The configuration wizard is pretty self-explanatory. One thing to notice is that if you choose "App permission", your uploads will end up on Dropbox under an App/<your_app_name> folder. To have them stored in another folder, such as in /dir/, you'll need to give Dropbox-Uploader permission to all Dropbox files.

Usage

The syntax is quite simple:

./dropbox_uploader.sh COMMAND [PARAMETERS]...

[%%]: Optional param
<%%>: Required param

Available commands:

  • upload <LOCAL_FILE/DIR ...> <REMOTE_FILE/DIR>
    Upload a local file or directory to a remote Dropbox folder.
    If the file is bigger than 150Mb the file is uploaded using small chunks (default 4Mb); in this case a . (dot) is printed for every chunk successfully uploaded and a * (star) if an error occurs (the upload is retried for a maximum of three times). Only if the file is smaller than 150Mb, the standard upload API is used, and if the -p option is used the default curl progress bar is displayed during the upload process.
    The local file/dir parameter supports wildcards expansion.

  • download <REMOTE_FILE/DIR> [LOCAL_FILE/DIR]
    Download file or directory from Dropbox to a local folder

  • delete <REMOTE_FILE/DIR>
    Remove a remote file or directory from Dropbox

  • move <REMOTE_FILE/DIR> <REMOTE_FILE/DIR>
    Move or rename a remote file or directory

  • copy <REMOTE_FILE/DIR> <REMOTE_FILE/DIR>
    Copy a remote file or directory

  • mkdir <REMOTE_DIR>
    Create a remote directory on DropBox

  • list [REMOTE_DIR]
    List the contents of the remote Dropbox folder

  • share <REMOTE_FILE>
    Get a public share link for the specified file or directory

  • saveurl <URL> <REMOTE_DIR>
    Download a file from an URL to a Dropbox folder directly (the file is NOT downloaded locally)

  • info
    Print some info about your Dropbox account

  • unlink
    Unlink the script from your Dropbox account

Optional parameters:

  • -f <FILENAME>
    Load the configuration file from a specific file

  • -s
    Skip already existing files when download/upload. Default: Overwrite

  • -d
    Enable DEBUG mode

  • -q
    Quiet mode. Don't show progress meter or messages

  • -p
    Show cURL progress meter

  • -k
    Doesn't check for SSL certificates (insecure)

Examples:

    ./dropbox_uploader.sh upload /etc/passwd /myfiles/passwd.old
    ./dropbox_uploader.sh upload *.zip /
    ./dropbox_uploader.sh download /backup.zip
    ./dropbox_uploader.sh delete /backup.zip
    ./dropbox_uploader.sh mkdir /myDir/
    ./dropbox_uploader.sh upload "My File.txt" "My File 2.txt"
    ./dropbox_uploader.sh share "My File.txt"
    ./dropbox_uploader.sh list

Tested Environments

  • GNU Linux
  • FreeBSD 8.3/10.0
  • MacOSX
  • Windows/Cygwin
  • Raspberry Pi
  • QNAP
  • iOS
  • OpenWRT
  • Chrome OS
  • OpenBSD

If you have successfully tested this script on others systems or platforms please let me know!

Running as cron job

Dropbox Uploader relies on a different configuration file for each system user. The default configuration file location is HOME_DIRECTORY/.dropbox_uploader. This means that if you do the setup with your user and then you try to run a cron job as root, it won't works.
So, when running this script using cron, please keep in mind the following:

  • Remember to setup the script with the user used to run the cron job
  • Use always the -f option to specify the full configuration file path, because sometimes in the cron environment the home folder path is not detected correctly
  • My advice is, for security reasons, to not share the same configuration file with different users

How to setup a proxy

To use a proxy server, just set the https_proxy environment variable:

Linux:

    export HTTP_PROXY_USER=XXXX
    export HTTP_PROXY_PASSWORD=YYYY
    export https_proxy=http://192.168.0.1:8080

BSD:

    setenv HTTP_PROXY_USER XXXX
    setenv HTTP_PROXY_PASSWORD YYYY
    setenv https_proxy http://192.168.0.1:8080

BASH and Curl installation

Debian & Ubuntu Linux:

    sudo apt-get install bash (Probably BASH is already installed on your system)
    sudo apt-get install curl

BSD:

    cd /usr/ports/shells/bash && make install clean
    cd /usr/ports/ftp/curl && make install clean

Cygwin:
You need to install these packages:

  • curl
  • ca-certificates
  • dos2unix

Before running the script, you need to convert it using the dos2unix command.

Build cURL from source:

DropShell

DropShell is an interactive DropBox shell, based on DropBox Uploader:

DropShell v0.2
The Intractive Dropbox SHELL
Andrea Fabrizi - [email protected]

Type help for the list of the available commands.

andrea@Dropbox:/$ ls
 [D] 0       Apps
 [D] 0       Camera Uploads
 [D] 0       Public
 [D] 0       scripts
 [D] 0       Security
 [F] 105843  notes.txt
andrea@DropBox:/ServerBackup$ get notes.txt

Donations

If you want to support this project, please consider donating:

dropbox-uploader's People

Contributors

andreafabrizi avatar chof747 avatar dandv avatar dustise avatar pjv avatar polyatail avatar poppen avatar rindeal avatar robertgc avatar rubenvarela avatar sandinmyjoints avatar thepanz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.