<div dir="ltr"><div dir="ltr">On Sat, Dec 28, 2019 at 3:07 PM Paul Nijjar wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I am sick and tired of tar. Using it for anything nontrivial is a<br>
nightmare, because its user interface is so bad and so finicky. <br>
(Example: --exclude='some/path' fails, but --exclude=some/path works.<br>
Meanwhile, --exclude=some/path/ also fails. But it always fails if it<br>
is in the wrong spot of the command, just because there is a secret<br>
ordering you have to remember. UGH.) <br></blockquote><div><br></div><div>I used to be confused with these exclude options, until I realized that <br></div><div> it takes a glob pattern, i.e. a shell like wildcard. Also, it needs the exclude</div><div>parameter to be before the -f one.</div><div><br></div><div>In other words:</div><div><br></div>If you say:</div><div class="gmail_quote"><br></div><div class="gmail_quote">cd mydir<br></div><div class="gmail_quote"><div>tar -czv --exclude="otherdir/*" -f archive.tgz .<br></div><div><br></div><div>It will exclude mydir/otherdir/* but include an empty directory entry for it</div><div>in the archive. <br></div><div><br></div><div>But if your current directory is different, then you do it like this<br></div><div><br></div><div>cd ~<br></div><div><div>tar -czv --exclude="<b>mydir</b>/otherdir/*" -f archive.tgz <b>mydir</b><br></div></div><div><br></div><div>And once it works and you script it, you will forget about it, and it should <br></div><div>always work from the script<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Unfortunately tar is ubiquitous, so I am not getting rid of it anytime<br>
soon. But is there something else that is good and has a sane<br>
commandline interface?<br>
<br>
- Creates archives<br>
- Allows flexible inclusions and exclusions<br>
- Probably compresses files, although I don't mind piping to gzip or<br>
bzip2 or xz <br>
- Easily available in Linux systems (ie packaged for Debian/Ubuntu)<br>
- Friendly to being used in scripts (even shell scripts, which are<br>
their own abomination). <br></blockquote><div><br></div><div>As you say tar is ubiquitous. <br></div><div><br></div><div>And as Jason said, cpio is a better archive tool. In fact, I used it a decade</div><div>exclusively and it worked well, once you get over the fact that it takes a</div><div>list of file from stdin, unlike a command line argument like tar does. <br></div><div>Again, once you script it, it will all work. <br></div><div><br></div><div>That was in the UNIX world.</div><div><br></div><div>Once GNU and open source matured, and Linux came along, tar was the <br></div><div>only archive format used. One advantage is that tar is portable. Cpio was</div><div>not always portable, and there are a myriad of option. Upgrading from <br></div><div>Motorola System V UNIX to Intel SVR4 required a few options. I think it</div><div>had to do with endianess. Tar does not have these limitations, but since</div><div>you will be always using Intel/AMD machines, and Linux, cpio should be <br></div><div>portable. <br></div><div><br></div></div></div>