If you have read my other project where I created a Raspberry Pi photo frame, then this could help you extend the functionality by automatically downloading your images. You could however use this to synchronize any files with your Raspberry PI. For this project i am just going to synchronize my sideshow photos from Dropbox.

  1. First open a Terminal window sand enter curl -L https://raw.github.com/pageauc/rclone4pi/master/rclone-install.sh | bash
  2. Once this has finished you are ready to configure Rclone
  3. Enter the command rclone config
  4. Enter n (for a new connection) and then press enter
  5. Enter a name for the connection (i’ll enter dropbox) and press enter
  6. Enter 8 for “Dropbox” and press enter
  7. Press Enter for client ID
  8. Press Enter for client Secret
  9. Enter n for advanced config
  10. Enter y for “use auto config”
  11. A browser window will then pop up and you can log into Dropbox.
  12. When you have entered your details, the next screen will appear asking you to allow access. Press the Allow option.
  13. You will receive a screen saying “Success”.
  14. Close the browser window and return to the terminal.
  15. Press y to complete the setup.
  16. Close the terminal window
  17. Now we have set up the connection however we still have to synchronize(download) the folder to the raspberry PI. to do this we will write a simple .sh script and set it to run at a set time.
  18. If your comfortable with a text editor you can enter this string into leafpad on the raspberry pi and save it as sync.sh rclone sync -v dropbox:images /var/www/html/slideshowimages (This sync command will make the Pi folder the exact same as the folder in Dropbox, ie it will delete any folders not in Dropbox) You can also change “/var/www/html/slideshowimages” to “/home/pi/Pictures” if you like.
  19. If you have used different names to me, replace dropbox with your connection name and replace images with your folder name(this is the folder name in your Dropbox account). You can also change the path, this is where the folder is synced to.
  20. If you don’t want to make the file yourself you can download the version at the end of this project already completed, You will just need to unzip it
  21. Either way you do it put the file in the /home/pi/Documents on your Raspberry Pi
  22. Make it Executable, in the terminal chmod +x /home/pi/Documents/sync.sh
  23. This file will call the connection and download any new files from Google Drive. This is good however we need to set it to run automatically.
      1. Only follow if your Pi doesn’t have a Desktop installed (Headless) or you have installed Raspian Buster– Run crontab -e  in the terminal
      2. Select 2 for nano
      3. Enter the following string – 0 * * * * /home/pi/Documents/sync.sh 
      4. Save the file ( usually Ctrl + O to save and Ctrl + X to exit) ,then skip to step 31
  24. (Depreciated, Gnome Schedule has been removed as of Raspian Buster. Only use if you have an older version. Use step 22.1 if you have Raspian Buster or newer) 

    Next we will install a tool to set the script to run automatically. Open a terminal and enter sudo apt-get install gnome-schedule (This is just a cron job interface, so if you are familiar with cron you can skip this app)

  25. Enter your password and once the installation is completed close the terminal
  26. Open the Raspberry Pi menu and under System Tools open Scheduled Tasks
  27. Select New and then A Task that launches recurrently
  28. Enter a Description if you like. In the command box enter /home/pi/Documents/sync.sh
  29. Next you can enter the times for synchronization, i’m going to leave it as default; which syncs every hour. Feel free to change this to your liking
  30. Then Click add
  31. Thats it! Restart your Raspberry Pi and add some photos to your Dropbox

PS. You can also use this for many other types of drives and the process is very similar. Just choose a different number in step 6.

sync.sh Zip File

This file syncs images to “/home/pi/Pictures”