rsync has a --list-only
option, which provides an index of the remote files, including timestamps:
$ rsync --list-only $REMOTE
drwx------ 160 2018/09/04 12:55:12 .
-rw-r--r-- 1,348 2018/09/04 12:52:33 .bash_profile
-rw-r--r-- 55 2018/09/04 12:52:33 .bashrc
...
Filtering on this list to select only appropriate dates, and then feeding that into a subsequent rsync's --files-from
argument (which can refer to stdin, by using --files-from=-
) should do the job.
For example, the following will rsync files with an mtime between 2018-08-01 and 2018-08-07 to the local machine (with appropriate values of $REMOTE
and $LOCAL_PATH
; note $5
in the awk command refers to the fifth column - i.e. the filename - from the rsync output)
$ rsync --list-only $REMOTE | awk '/2018-08-0[1-7]/ {print $5}' | rsync --files-from=- $REMOTE $LOCAL_PATH
This doesn't answer the full problem of using find
's -mtime
-type specifiers, but further parsing of the date string (e.g. using date
) could be done to extend this.