in reply to exit value in tar command

A TMTOWTDI not using ksh (considered harmful) - not thoroughly tested and written in a hurry (but also assuming that using tar is the most performant way for recursive copying of dirs):

#!/usr/bin/env perl use strict; use warnings; use Capture::Tiny qw(capture); use Path::Tiny; use feature qw (say); my $source = qq(nose/); path("failure.ok")->touch && die $! unless -e $source; my $target = qq(fubar/); path("failure.ok")->touch && die $! unless -e $target; my $tar = qq(tar cf - $source | (cd $target && tar xvf - )); my ( $stdout, $stderr, $exit ) = capture { system($tar); }; say $stdout; say $stderr; say $exit; $exit ? path("failure.ok")->touch : path("success.ok")->touch; __END__

IPC::Run might also be interesting.

Best regards, Karl

«The Crux of the Biscuit is the Apostrophe»