Hi Tim,

> I want to compress my rsynced home folder, I want the video folder in
> the final compressed file but I don't want tar to try and compress it
> as it compresses the rest of the home folder, does that make sense?

Yes, but it can't be done.  tar(1) creates a tar file, and that's a
simple catenation of a bit of metadata about the next file, and then the
file's bytes, padded out to a nice round multiple of bytes for each
file.  Traditionally, you'd have either piped tar into a compression
program, or produced foo.tar and then compressed it with a separate
command.

These days, tar has grown options for compressing, but they just do the
pipe for you.  Here's tar processing the `j' option and kicking off a
bzip2(1) as the destination for write(2)s.

    $ strace -fe execve tar cjf /dev/null foo
    execve("/usr/bin/tar", ["tar", "cjf", "/dev/null", "foo"], 0x7ffe017683a8 
/* 66 vars */) = 0
    strace: Process 3162 attached
    strace: Process 3163 attached
    [pid  3163] execve("/bin/sh", ["/bin/sh", "-c", "bzip2"], 0x7ffe0deb68c0 /* 
66 vars */) = 0
    [pid  3163] execve("/usr/bin/bzip2", ["bzip2"], 0x73a950 /* 66 vars */) = 0
    [pid  3163] +++ exited with 0 +++
    [pid  3162] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3163, 
si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
    [pid  3162] +++ exited with 0 +++
    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3162, 
si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
    +++ exited with 0 +++
    $

And the compression programs just see a stream of bytes, they've no idea
that it's a tar file, and that you'd like the video directory to be
skipped.

That said, you could let the compressor attempt to do it anyway.  It
will burn some CPU, and may grow slightly in size.  Or, exclude it from
the compressed tar file and produce a second, video, uncompressed tar
file.

What do you do with these tar files then?  Is rsync and tar the right
combination?  (I use tar for backups myself so I'm not against it per
se.)

Cheers, Ralph.

-- 
Next meeting:  Bournemouth, Tuesday, 2017-09-05 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue     / TO THE LIST OR THE AUTHOR

Reply via email to