You need to synchronize the file from the site directory, recursively, but only what has been changed or new during this week has to be synchronized. That is, we believe that all files older than a week are already in the backup.

I use the webdav yandex disk as a storage, but it is very slow and does not support either a comparison by modification date or checksums. There is only a comparison in size. While performing a check on all folders, you can already sleep))). I want to speed up the process.

  • did you find to find utility with the -ctime -7 parameter ( the last time the owner or file access rights were changed (in days) )? First find the changed files, then copy them. - approximatenumber

1 answer 1

  1. find files (in the current directory and deeper), the modification date of which is less than seven days:

     $ find -type f -mtime -7 

    the list will contain the relative path to the files.

  2. You can create a number of rsync опции-rsync путь/к/файлу место-назначения commands from this list with the rsync опции-rsync путь/к/файлу место-назначения using the xargs program:

     $ find ... | xargs -I'{}' rsync опции-rsync '{}' место-назначения 
  3. in order to properly handle spaces and other special characters in file / directory names, it makes sense to add the -print0 option to the find program, and -0 , respectively, to the -print0 program:

     $ find ... -print0 | xargs -0 -I'{}' rsync ...