I'm working on a 'find' command which uses the -exec option to tar a listing of files that it finds. Is there a single option available that would both 1) create the TAR file if it doesn't exist and/or 2) update the TAR file if it already exists?
Currently when I want manually create a TAR file and then add files to it I need to issue two different options to the TAR command. In other words, my command sequence needs to look like:
tar -cvf myTarFile.txt fileA.txt
tar -uvf myTarFile.txt fileB.txt
tar -uvf myTarFile.txt fileC.txt
So in the first iteration I have to include the -c (e.g. create TAR file) option. And in subsequent iterations I have to include the -u (e.g. update TAR file) option.
I want to avoid programatically having to issue a different command for the first iteration. Is this possible?
Any help would be greatly appreciated!!!