Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Executable to delete files fitting certain criteria, useful do delete old backups
Ruby
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
lib
spec
.document
.gitignore
Gemfile
Gemfile.lock
LICENSE
README.rdoc
clean_files.gemspec

README.rdoc

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 © 2009 AlphaSights Ltd. See LICENSE for details.

Something went wrong with that request. Please try again.