create tar file backup in gz and keep for 180 days (6 months) before removing
I want to create a shell script to take compressed backup of ABCD.XYZ.*.tar and XYZ.ABCD.*.tar files and keep for 180 days ( 6 months ).
After 6 months they can be removed, latest 6 months files will be on the system and older should be removed.
Files are already .tar and generated daily. Each file is 50 MB approx.
Then all that remains is to remove as Simon's script demonstartes.
You would stager I.e. Move files
60 day old
90 day old
120 day old
180 day old
The reason, if there is a large number of files the rm() \; could run into issues as there is a limit on how many/large tge list can be.
The above breakdown would limit the amount of data transitioning through each stage.