I am unpacking tar files with the --keep-old-files
option so that I don't clobber files that are already there. The annoying thing is that this causes tar to produce an error code #2 (fatal error) when a file is already there.
The reason it's important to me that this should not be considered an error is because my script logs when a file is successfully unpacked and then uses this log in order to not re-unpack that tar file.
I could just ignore this error completely, not log, and trust that no files will be overwritten but there are two problems with this: it generates a lot of error messages, and there are many files, so it's inefficient for me to open tar once for every file.
Is there any way I can use --keep-old-files
, ignore the errors generated by existing files, and not ignore other errors?