How to rsync files older than XXX days from one server to another?

I have a number of image files on a server that I need to temporarily move to another server to reduce the HD capacity.

Unfortunately, I need to keep the newer image files on the server as they are being actively viewed by users.

Is there anyway to rsync files that were created before, for example, one year ago from one server to another?

Eventually, we will increase the HD capacity at which time I will need to move these files back - which is why I am considering rsync (to maintain directory structure).

I know how to rsync entire folders (and subfolders) but do not know if it is possible to target specific files.

Any ideas?

bearclaws75Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TripyreCommented:
the application robocopy is a great way to copy files and keep them insync, there are many options and switches to copy/mirror/purge etc.
0
gmckeown99Commented:
You can use the -u switch, which is the "Update only if newer". So on the side with the newer files, pull in the older files and it will not update if the timestamp is newer.

rsync -rpogltu user@..... /some/path . for a pull. I always use the "poglt" switches to make sure the timestamps and user/groups are maintained.
0
TintinCommented:
I was also going to mention the rsync -u option.  Sounds like that's all you need to use.
0
tkutherCommented:
We are doing exactly the same thing, in three steps

1. Create list of affected files
$ find . -type f -ctime +180 -print > ${TMPLIST}

2. Sync to the other box
$ rsync -avz --files-from=${TMPLIST} ./ ${EXCH_USER}@${EXCH_HOST}:${TARGET_DIR}/

3. Delete after sucessfull sync
$ cat ${TMPLIST}|xargs rm -f

HTH,
Tom
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bearclaws75Author Commented:
I worked this out over the weekend and came up with the same solution (tkuther).

I added this rsync option which deletes the source files after they have been sync-ed:
"--remove-sent-files"

This eliminates the need setup #3 above.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Storage Software

From novice to tech pro — start learning today.