tar exclude tag

Posted by superstar on Stack Overflow See other posts from Stack Overflow or by superstar
Published on 2010-03-31T00:23:50Z Indexed on 2010/03/31 0:43 UTC
Read the original article Hit count: 457

Filed under:
|

I have the following folder structure. myFolder and testFolder have same folders underneath it and I want to exclude only my1 from testFolder and not myFolder

"myFolder" which has -my1 -my2 -my3

"testFolder" which has -my1 -my2 -my3

I am trying to use exclude tag along with included folders while creating a tar file. This is what i have, but it does not seem to work.

tar -cvf base.tar "/sam/myFolder" "/sam/testFolder" --exclude="/sam/testFolder/my1"

I want to exclude my1 from testFolder and not myFolder. can you please suggest a possible solution.

© Stack Overflow or respective owner

Related posts about tar

Related posts about exclude