Giter Club home page Giter Club logo

dir2server's Introduction

upload & download files between client and server using dropbox


Just a doduck prototype

This project is just a quick prototype aimed to explain the command line interface in Java and how to create a dropbox application.

Please read the related article on Dropbox App in Java CLI or in French Développer une App Dropbox en Java

Tutorial

[![watch on Youtube] (/README_src/watch-on-youtube-en.png "watch on Youtube")] (http://www.youtube.com/watch?v=h3UtTEa-tEM)

[![watch on Youtube] (/README_src/watch-on-youtube-fr.png "regarder sur Youtube")] (http://www.youtube.com/watch?v=FK71SR0qgBg)

After watching the youtube video you will have an executable jar call "dir2server.jar"

Upload from your client

In order to upload a file in your dropbox run the command:

java -jar --upload myBigFile.zip

First time your run this command you will get this kind of message:

Accept the app by openning your browser at this URL:
https://www.dropbox.com:443/1/oauth/authorize?oauth_token=RwoTAsNV4W5AUcvN&locale=en
THEN press any key:

Open your browser at this url and accept the app.

Then press any key into your console.

WARNING:

  • The app will ONLY be able to access dropbox/Apps/dir2server/ it can't access any other file
  • In case you failed the authentification remove the file into .client2server created in your home folder

Download from your server

Just before uploading the file into your dropbox. You will get a message like

You have to run on the server (Only once):
java -jar [JAR_NAME] --accessKey RwoTAsNV4W5AUcvN --secretKey RwoTAsNV4W5AUcvN

Run the following command on the server. It will start the download the file as soon as the upload finish
java -jar [JAR_NAME] --download myBigFile.zip

You can also get notify by email when the server finish to download the file.
java -jar [JAR_NAME] --download myBigFile.zip --email '[email protected]' --smtp 'your.smtp.com' --login 'your login' --password 'your password'


Start upload ? Y/N :

If it's the first time you use the app on your server run this command on your server:

java -jar [JAR_NAME] --accessKey RwoTAsNV4W5AUcvN --secretKey RwoTAsNV4W5AUcvN

It will give your server all the requiment to access your dropbox/Apps/dir2server/ folder (Where the myBigFile.zip will be uploaded)

Then you can run the download from your server using the given command given before the uplaod:

java -jar [JAR_NAME] --download myBigFile.zip

You can run this command before, during or after your uploaded the file! dir2server.jar will download the file as soon as it's available to download.

You can get an email back when the download is finish using this kind of command line:

java -jar [JAR_NAME] --download myBigFile.zip --email '[email protected]' --smtp 'smtp.gmail.com' --login '[email protected]' --password 'myPassword'

Dealing with overwriting file

When you upload a file who already exist you will get a message like:

Run the following command on the server. It will start the download the file as soon as the upload finish
java -jar [JAR_NAME] --download myBigFile.zip -x f2a87eb52e

When running this parameter "-x f2a87eb52e" dir2server will only download the file after it at been uploaded. Under the hook it just wait until the version change from f2a87eb52e into something else.

Contact

Developed by Martin Magakian [email protected] for doduck prototype

License

MIT License (MIT)

by Anomaly Detection

dir2server's People

Contributors

martin-magakian 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.