Skip to content
This repository has been archived by the owner on Jun 19, 2020. It is now read-only.

Executable to delete files fitting certain criteria, useful to delete old backups

License

Notifications You must be signed in to change notification settings

toreriklinnerud/clean-files

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CircleCI

Synopsis

Executable to delete files fitting certain criteria.

The intended purpose is to delete backups older than a certain date, whilst keeping hourly, daily or weekly and so on backups.

Specifying an option like --hourly will keep the first file of the hour and delete the rest of the files created within the same hour, provided that the those files were created before the threshold date.

The executable does not itself create any backups, it is only intended for cleaning up existing ones.

Usage

  clean_files file_paths [options]

For help use: clean_files -h

Options

  -v, --verbose     Print name of files deleted
  -p, --pretend     Implies -v, only prints what files would have been deleted
  -r, --recursive   Delete directories as well as files
  -t, --threshold   Time ago in days for when to start deleting files
                    File newer than this date are never deleted.
                    The default is 30 days.

                    For example:

                   -t 10 or --threshold=30

  -H, --hourly      Keep hourly files
  -D, --daily       Keep daily files
  -W, --weekly      Keep weekly files
  -M, --monthly     Keep monthly files
  -Y, --yearly      Keep yearly files

Examples

  clean_files /backups/sql/*.sql --threshold 60 --daily
  clean_files /Users/me/Downloads/* --pretend --verbose --recursive -t 10

Copyright

Copyright (c) 2009 AlphaSights Ltd. See LICENSE for details.

About

Executable to delete files fitting certain criteria, useful to delete old backups

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages