pageauc / pi-timolo

Raspberry PI-TIMOLO ( PI-TImelapse, MOtion, LOwLight ) uses RPI picamera and OpenCV for Remote Headless Security Monitoring using Motion Tracking, Rclone Auto Sync files with remote storage services. Auto Twilight Transitions and Low Light Camera Settings. Panoramic images using PanTiltHat and More. This project is featured on GitHub Awesome software.
MIT License
552 stars 102 forks source link

rclone-sync deletes all files it does not transfer #83

Closed malialis closed 6 years ago

malialis commented 6 years ago

I apologize if I am not understanding how rclone-sync works. Or if I am doing something wrong. Which is very possible.

When ever I do sync any of the saved images on my google drive will be deleted and only the new images will be present.

Is there a way to keep old images too.

I have a cron job set up to sync every 10 minutes and then all the photos get deleted except the 20 new ones.

pageauc commented 6 years ago

Sync makes the destination folder identical to the source folder. Files that are not in the source folder are sent to the destination remote name trash. You should be able to find them there. Rclone can do many things including copy. type rclone --help for all the commands. You can copy one of the rclone sample batch files and replace the sync command with the copy command.

cd ~/pi-timolo
cp rclone-motion.sh rclone-mo-copy.py
nano rclone-mo-copy.py

Use nano to edit per example below and change sync to copy then ctrl-x y to save and exit.

echo "INFO  : /usr/bin/rclone copy -v $localSyncDir $rcloneName:$remoteSyncDir"
echo "        One Moment Please ..."
 /usr/bin/rclone copy -v $localSyncDir $rcloneName:$remoteSyncDir

Test changes

./rclone-mo-copy.sh

This should copy only the differences and skip over anything that is already existing. Then change cron to run the new rclone batch file.

You should be able to move the trash files back to the original folder using the remote name web page or client app.

I will look at adding an example copy script.

Let me know how you are doing Regards Claude ...