When using gtar to add extra files to an existing archive, the loop terminates prematurely or hangs. It also terminates after creating the initial tar.gz file.
However, if I remove the gtar calls from the loop and put print statements in their place instead, the loop executes as expected. Does anyone know why this is? Below is the code contained inside the loop.
if (-e "flex_$yearA"."_"."$monthA.tar.gz")
{ print"accessing Flex tar \n";
exec "gtar --append --file=flex_$yearA"."_"."$monthA.tar.gz $FILE";
}
else
{ print "creating Flex Tar \n ";
exec "gtar -cvsf flex_$yearA"."_"."$monthA.tar.gz $FILE";
}