Deleting files after adding to tar archive

bash, compression, tar, unix

Solution

With GNU tar, use the option `--remove-files`.

Problem

Can GNU tar add many files to an archive, deleting each one as it is added? This is useful when there is not enough disk space to hold both the entire tar archive and the original files - and therefore it is not possible to simply manually delete the files after creating an archive in the usual way.

Original source

Related problems