I am using rsync to copy folders/ subdirectories from certain date and exclude all folders which is less than 180 days old.
My Folder Structure on Server1:
./BradsbarIN
./2016-06-01
a.jpg
b.jpg
c.jpg
./2016-06-02
a.jpg
b.jpg
c.jpg.
These dates go onto 2012-01-01. I want to rsync only last 180 days folders and exclude everything below from this date(2016-03-01).
rsync -avzn --list-only --include 'BradsbarIN/' --include 'BradsbarIN/2016-06-01/***' --exclude '*' -e ssh user@server.com:/path/to/old/data/ /path/to/new/data
我想仅复制2016-03-01文件夹中的所有数据。是否可以这样做。
答案 0 :(得分:0)
你可以这样做:
rsync -avzn \
--list-only \
--include 'BradsbarIN/' \
--include 'BradsbarIN/2016-0[3-9]*/***' \
--include 'BradsbarIN/2016-1*/***' \
--include 'BradsbarIN/201[7-9]*/***' \
--exclude '*' \
-e ssh \
user@server.com:/path/to/old/data/ \
/path/to/new/data
我添加了规则,使其在接下来的几个月和几年内继续发挥作用,但您现在只需要前两个包含规则。