Deleting files after adding to tar archive

Rory picture Rory · May 28, 2012 · Viewed 56.1k times · Source

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.

Answer

Fred Foo picture Fred Foo · May 28, 2012

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