Berkeley CSUA MOTD:Entry 40270
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2024/11/22 [General] UID:1000 Activity:popular
11/22   

2005/10/25-26 [Computer/SW/Unix] UID:40270 Activity:nil
10/25   Suppose I have directories foo, foo/bar, and foo/bar/{a,b,c}. (In
        actuality, there are a lot more files.) I'd like tar to archive
        everything under foo, except for foo/bar/*, except I do want to keep
        foo/bar/a. Unfortunately, tar's exclude patterns seem to take
        precedence over any include patterns, so if I exclude foo/bar, I can't
        then include foo/bar/a. The easiest workaround I see is to just exclude
        foo/bar, and then call tar a second time to append foo/bar/a. Is there
        a way to do this with a single call to tar?
        \_ Use find to generate a file or dir list, your favorite filtering,
           and tar --files-from=<file> to archive the exact list?  append
           will yield basically the same thing, due to lack of indexing in
           tar format.