0

So i have this one-liner i used:

find . -maxdepth 1 -mindepth 1 -type d -exec tar cvf {}.tar {} --remove-files \;

Where it tar each top directory into their own tar archive, while deleting files after.

Now when it accidentally stop, for whatever reasons, how can i make it continue again? Without recreating the tar when it already exist.

I'm aware of the --update flag, but to my knowledge:

 -u, --update
       only append files newer than copy in archive

Seems to only update if the file is newer, and doesn't really add files when they're not there.

How can i do what i mentioned above, using Bash/Unix tools?

1

Use r (append mode) instead of c:

find . -maxdepth 1 -mindepth 1 -type d -exec tar rvf {}.tar {} --remove-files \;

This will create an archive if it doesn’t already exist, and append to it if it does.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.