0

Ive been messing around with raspberry pis now for about a month and have come abit stuck.

I have set up a media server with 1 pi (6TB) and set up osmc with another (1TB). In the media server i have sonarr and radarr set up that will organise files into films and tv shows. I have mounted the server in osmc. What I need is a script to copy only new files from one directory to another. The files will be in subfolders. I was thinking crontab with a script linked to it to search every 15 mins to update osmc folders. 1 for tv shows 1 for movies.

Any help would be much appreciated Thank you

  • 2
    So you need help with the crontab? the script? both? The crontab part is easy, but what the script has to do is far from clear (at least to me). – NickD Jan 5 '18 at 2:47
  • 1
    Have you looked into rsync and read the man page? I don't think you need a script at all. I think you need a fancy rsync command with a bunch of flags. – Wildcard Jan 5 '18 at 3:04
  • As mentionned by Wildcard, I think you need a rsync command line in a crontab to feet your needs. maybe something similar to rsync -zauv /path/sources/tree /path/destination/ then all subfolders updates modified & new files will be add/updated on destination path – francois P Jan 5 '18 at 7:32
0

Thanks for the help and pointing me to rsync. I made this script

#!/bin/sh

cd /directory/of/source/

find -type f -mmin -(time in mins) -exec rsync -zauv {} /directory/of/destination/ \;

Ran it on 2 test folders and all seemed to work. Just to link it to crontab and all done.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.