Skip to content

a simple tool to find files matching a given set of timestamps

Notifications You must be signed in to change notification settings

bcampbell/retain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

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

About

a simple tool to find files matching a given set of timestamps

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages