Two questions for Rsync - rsync by date and filename

I have two questions regarding rsync:

1: I have a bunch of files that increase with the days of the year. Ex: file.txt.81, file.txt.82, etc. Now these files are located in different directories:

data1 / file.txt.81 data1 / file.txt.82 data2 / file2.txt.81 data2 / file2.txt.82

How can I get rsync only * .82 files and not even touch other files

2: Now I have a similar data directory structure as above. How can I rsync all files that were changed on or after a certain day?

thanks

+2


a source to share


1 answer


Here is the answer for # 1 rsync -avz --include "**/" --include=*.82 --exclude=* /path/from /path/to

This will recursively (-a) include directories and search them for something suitable .82 and exclude everything else. You can find more information on this at man rsync

and look for "exclude patterns"



For # 2, I'll find a way to do this with find and mtime. To find files modified in the last 60 minutes named * .82, this should work: sudo find /path/from -mmin 60 -type f -name *.82

EDITED: too many backticks

+2


a source







All Articles