[Chicago-talk] Merging two dir's into a third

Don Drake don at drakeconsult.com
Wed Feb 18 13:53:20 CST 2004


>
> -- Don Drake <don at drakeconsult.com>
>
> >
> > This will work:
> >
> ># cd dira
> ># tar cvf - *  | (cd ../dirc; tar xvf -)
> ># cd ../dirb
> ># tar cvf - *  | (cd ../dirc; tar xvf -)
>
> Problem with this is that tar exits zero on most
> errors, which makes it hard to tell if the job
> completed. For example, this will exit zero on
> a filesystem-full error (at least with the tar's
> I've used on linux, solaris, hp-ux, osf/1, and
> aix).
>

This is not true.  My tar command on Linux and Solaris return non-zero upon
failure.  Maybe time for an upgrade?

However, my example will return 0 if the disk fills, because the command
"tar cvf - *" was successful, and the rest of the commands were piped and
failed.

Wrapping the entire line in parentheses "(tar cvf - *  | (cd ../dirc; tar
xvf -) )" would fix that.

-Don






More information about the Chicago-talk mailing list