This tutorial is built on the amazing piece of software made by Andrea Fabrizi. I found it on Raspi.tv and it is one of the handiest things I have come across yet.
A timelapse project I have been working on uses Dropbox to transfer files between one Raspberry Pi and another computer. In short, I have a RPi camera that is taking pictures and making movies, which need to be uploaded every day. Another computer downloads and processes those movies every night.
You will need:
- Raspberry Pi connected to the Internet
- Dropbox Account with Developer Access
Lets work on Dropbox first
- Log on to Dropbox (assuming you have an account) access the developer side of things. This link will take you there.
- Any apps you already have are listed there. I have a few. You will need to create a new app.
- When you click on a Create App, you get to name and make a new app. There are just three question. Will it be Dropbox or Dropbox Business? Do you want it to access just this app or all of Dropbox (I usually select just this app)? What will you call it?
- When this done you are taken to a settings page that has some information on it. You are going to need an access token, so look for the Generate Token and click it. That will create a unique token for you that you will need later. Copy it. This is what the screen looks like, but I have obscured the token.
- That is all. You can go to the Raspberry Pi now.
- You will need to download the Dropbox-Uploader from Andrea’s github page. Make sure you are in the home directory first.
Then download the folder from github
git clone https://github.com/andreafabrizi/Dropbox-Uploader.git
- This will create a new folder called Dropbox-Uploader in your home directory. Go into it.
cd Dropbox-Uploader ls
- You will want to run the dropbox_uploader.sh file (already made executable).
This will start the program, and it will ask you for the token you recently generated.
Just paste it right in. If you are doing this through PUTTY, pasting is the same as right-clicking. It will ask you to confirm, and you hit y for yes.
- That is it. All done.
Try it Out
Now you can try to upload something.
The structure of the command works like this:
./dropbox_uploader.sh upload /path/to/file file
So you are using the program (dropbox_uploader.sh) to (upload) a local file (/path/to/file) and put it in dropbox with a name (file). For me at least, the file name I have locally is the same file name I want on dropbox so it remains the same.
You don’t need to be in the Dropbox-Uploader folder to do this. You can do it from anywhere. For example, if I want to upload a file from the USB it would look like this
/home/pi/Dropbox-Uploader/dropbox_uploader.sh upload /media/usb/picture.jpg picture.jpg
Andrea’s wonderful program will do a lot more than just upload. You can visit his github page for more examples.