S
S
Sergey Sashkin2019-05-21 15:25:42
linux
Sergey Sashkin, 2019-05-21 15:25:42

How to transfer files of backups of the last day to rsynch?

I have a backup script

find $source -type f -ctime +1 -printf '%P\0' | rsync  --remove-source-files -Pr                                                                                                                                                           v --log-file=/root/rsync.log --delete -e ssh --files-from=- --from0 $source root                                                                                                                                                           @10.204.5.62:/$dest

but it doesn't copy all the files and doesn't delete everything
, in general, advise the syntax of the find command so that the files from the previous day would be taken
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Saboteur, 2019-05-21
@saboteur_kiev

well, you're passing a list of specific files to rsync. It is clear that when trying to delete, you can only delete from this list, which is not correct.
You specify what exactly you have stored in $source
For example, you can just sync everything that is "-1" a day through find | rsync
And delete old files with a separate command like:
find /my_synced_files/ -type f -ctime +1 -delete

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question