Script Dumpster: Keep last X amount of files or Y amount of days
Ever had the need to remove all but the last X amount of copies of a back-up?
And I’m not talking about the copies from the last 2 days, because this can cause issues if the files aren’t created daily [in case of a weekend], in case a back-up has failed in the meantime or if multiple back-up copies have been made in one day.
While at first I was always playing around with the simple solution by checking file age, I ran into a more elegant solution I’d like to share with you.
