andreafabrizi / Dropbox-Uploader

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.
https://www.andreafabrizi.it/2016/01/01/Dropbox-Uploader/
GNU General Public License v3.0
6.56k stars 1.08k forks source link

recursive creation of folder with dropbox uploader #425

Open apriscatole opened 6 years ago

apriscatole commented 6 years ago

I use dropbox uploader to upload photo taken with my raspberry camera...the first time that I run the script the folder is created correctly. The second time another folder is create with the same name. The third time is ok.

pi@dvmeteo-pi:~/picamera $ /bin/bash /home/pi/dropbox/picamera.sh

Creating Directory "/picamera"... DONE Uploading "/home/pi/picamera/camera.txt" to "/picamera/camera.txt"... DONE Uploading "/home/pi/picamera/image1.jpg" to "/picamera/image1.jpg"... DONE Uploading "/home/pi/picamera/image2.jpg" to "/picamera/image2.jpg"... DONE Uploading "/home/pi/picamera/image3.jpg" to "/picamera/image3.jpg"... DONE

first time, it's ok

pi@dvmeteo-pi:~/picamera $ /bin/bash /home/pi/dropbox/picamera.sh

Creating Directory "/picamera/picamera"... DONE Uploading "/home/pi/picamera/camera.txt" to "/picamera/picamera/camera.txt"... DONE Uploading "/home/pi/picamera/image1.jpg" to "/picamera/picamera/image1.jpg"... DONE Uploading "/home/pi/picamera/image2.jpg" to "/picamera/picamera/image2.jpg"... DONE Uploading "/home/pi/picamera/image3.jpg" to "/picamera/picamera/image3.jpg"... DONE

the dropbox path is picamera/picamera and the script uploads again the file

pi@dvmeteo-pi:~/picamera $ /bin/bash /home/pi/dropbox/picamera.sh

Creating Directory "/picamera/picamera"... FAILED printf: operando mancante Try 'printf --help' for more information. Skipping file "/home/pi/picamera/camera.txt", file exists with the same hash printf: operando mancante Try 'printf --help' for more information. Skipping file "/home/pi/picamera/image1.jpg", file exists with the same hash printf: operando mancante Try 'printf --help' for more information. Skipping file "/home/pi/picamera/image2.jpg", file exists with the same hash printf: operando mancante Try 'printf --help' for more information. Skipping file "/home/pi/picamera/image3.jpg", file exists with the same hash

3° time, no uploads

probabily I run the script in a wrong way....

kot7k commented 5 years ago

This is super-late but i think there is a problem with your script "picamera.sh" Seeing your output, the third time it seems that it wants to put the files in the same folder as the 2nd time, so dropboxuploader is just telling you that the files already exist. Maybe you could post picamera.sh to see what it does if you didn't solve this yet.

apriscatole commented 5 years ago

Hi, thanks for the reply:

camera.sh

/usr/bin/python2.7 /home/pi/picamera/camera.py

and

camera.py

import time import datetime import picamera

t = datetime.datetime.now().strftime("%Y.%m.%d %H.%M.%S") camera = picamera.PiCamera() camera.vflip = True camera.resolution = (1024,768)

camera.resolution = (1920,1080)

camera.start_preview() name = "/home/pi/picamera/images/"+t+'.jpg' camera.capture(name)

dropbox_upload

/home/pi/stazione/code/Dropbox-Uploader/./dropbox_uploader.sh -f /home/pi/picamera/images/ delete camera /home/pi/stazione/code/Dropbox-Uploader/./dropbox_uploader.sh -f /home/pi/stazione/dropbox/dropbox_uploader upload /home/pi/picamera/images/ camera

kot7k commented 5 years ago

I don't get what are you trying to achieve... -f option is for loading different configuration files, what are you trying to do with this command: /home/pi/stazione/code/Dropbox-Uploader/./dropbox_uploader.sh -f /home/pi/picamera/images/ delete camera
Obviously "-f /home/pi/picamera/images/" that folder is not a configuration file. Maybe you wanted this: /home/pi/stazione/code/Dropbox-Uploader/./dropbox_uploader.sh -f /home/pi/stazione/dropbox/dropbox_uploader delete camera
But if you are only using dropbox uploader with 1 configuration file you dont need the -f option. And it seems that you first try to delete the camera folder from your dropbox and then upload it again? How is that recursive? Also in your first post your images didnt have the date in the name.

I guess you modified the script since the first time you posted.

Could you say what you want the script to do and what is it really doing right now?