Validate tar extraction

I have a script that processes large tar.bz2 and tar.gz files.

So the user doesn't think it has locked up they are piped in from pv:

pv redacted.tar.bz2 | tar -xj
pv redacted2.tar.gz | tar -xz

Problem is these files are large and takes time. If a user decides to cancel the script operation the next time they run it it will have to start from the very beginning if if they cancelled it at 99%.

Is there are way of having it to check the files are already present on disk and only extract those that are missing?


-k flag for tar sounds like what you would want. From the help section:

-k Keep (don't overwrite) existing files