Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
a simple tool to find files matching a given set of timestamps
Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Failed to load latest commit information.|
retain - a simple tool to find files matching a given set of timestamps Designed for culling excessive backup files. The timestamps are in the filenames, YYYY-MM-DD or YYYYMMDD, eg: foo-2010-01-01.tar.gz foo20100101.tar.gz Examples: find files from the last 5 days, and then everything on the 1st of the month: $ retain -f "last 5 days, monthly" * find backups for the last week, and then the last 6 months on the 12th of the month: $ retain -f "7 days, 6 months on 12" /home/bob/backups/*.tar.gz find files on the both 1st and 15th of the month: $ retain -f "monthly on 1, monthly on 15" * keep only files from last 3 days, and also the 1st or 12th of the month $ retain -n -f "last 3 days, monthly on 12, monthly on 1" /home/bob/backups/* | xargs rm