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'm trying to sync a large tree on Linux, but include and exclude certain files/directories. My question is regarding rsync's --relative option and how relative paths are handled. Directory structures appear something like:

/x/z1/company1/file1
/x/z2/company2/file1
/x/z3/company3/dir1/file3
/x/z4/company1/dir2
/x/z5/company1/dir3/file4

I want to transfer directories and files under 'company?' non-recursively. This (so far) appears to do what I am after:

rsync -a --relative /x/./z? --include '/x/*/*/*' --exclude '/x/*/*/*/*' a@b:/x

How could I specify the inc/excl rules as relative paths? What would this do?

rsync -a --relative /x/./z? --include '*/*/*/*' --exclude '*/*/*/*/*' a@b:/x

How will the patterns match? In order words, are the patterns relative to /x or to /x/./z ?

share|improve this question
    
Please remember to include your operating system in your question. Is this Linux, AIX, UNIX, OSX, BeOS, what? –  terdon Jul 6 '13 at 12:53
    
linux. added to OP. thank you. –  Felipe Alvarez Jul 7 '13 at 23:13

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.