Every day I'm deleting log files in a folder.
find ~/folder -mtime +28 -type f -delete
Now I would like to archive and compress all files affected by above delete command and store this tar.gz in a new directory folder2.
So let's assume this:
~/folder: - x1 (3 days old) - x2 (3 days old) - y1 (29 days old) - y2 (29 days old) ~/folder2: - genericname1.tar.gz: (some already present archive) - ...
archive, compress and delete
~/folder: - x1 - x2 ~/folder2: - genericname1.tar.gz: - ... - genericname2.tar.gz: - y1 - y2