GNU tar --remove-files option


I just now realized that GNU tar has a --remove-files option. From the man page:

          Remove files from disk after adding them to the archive.

So when creating a tar archive, the option removes each of the original files as soon as it has been added to the archive. I found it especially useful when dealing with a server that is low on disk space.

$ find .

$ tar --remove-files -czf logs.tar.gz logs

$ ls