0

I am attempting to use a combination of find and rsync to backup all files in a directory older than 7 days, as a part of a weekly backup script to a password protected server.

I am using find /local/directory/path -mtime +10 -exec rsync {} username@serverhost:/server/directory/path with no luck. I receive the error find: missing argument to -exec

Is there something I am missing or could someone point out the error? On the other hand, is this the best way to backup all the files that satisfies the requirement while entering the server's password only once?

Thank you in advance!

1 Answer 1

0

You need to end rsync's -exec with an escaped semi-colon: \;

So find /local/directory/path -mtime +10 -exec rsync {} username@serverhost:/server/directory/path \;

Though that will spam rsync commands. Perhaps do something like https://unix.stackexchange.com/a/87022/140671 instead so it only does 1.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .