Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to run rsync on server A to copy all files from Server B when they are newer than 7 days.(find . -mtime -7)

I don't want to delete the files on Server B.

Thanks for you help.

share|improve this question

migrated from stackoverflow.com Jun 15 '11 at 1:53

This question came from our site for professional and enthusiast programmers.

    
b) how often do you run rsync? –  phresnel Jun 14 '11 at 13:53

1 Answer 1

up vote 6 down vote accepted

This should get you underway in a solid way

rsync -RDa0P \
    --files-from=<(find sourcedir/./ -mtime -7 -print0) \
    . user@B:targetdir/

This copies device nodes, permissions, timestamps. I'm pretty sure the -H option won't be accurate with --files-from

share|improve this answer
    
To set that as a remote filter: rsync -avn --files-from=<(ssh user@A 'find /path/on/A/ -mtime -7 -type f -exec basename {} \;') user@A:/path/on/A/ user@B:targetdir –  cybertoast 8 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.