Name: cookbook-cleanup
Owner: racker
Description: This cookbook creates a `cleanup` resource to handle the cleanup of arbitrary paths based on number of files or last modified dates.
Created: 2014-03-04 16:40:22.0
Updated: 2018-01-31 13:13:09.0
Pushed: 2018-02-11 11:16:05.0
Homepage: null
Size: 28
Language: Ruby
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
This cookbook creates a cleanup
resource to handle the cleanup of arbitrary paths based on number of files or last modified dates.
name
- String representing a path glob so wildcards are totally fine.dry_run
- true
/false
Defaults to false
. If true
will disable actual file operations.`files
- true
/false
Defaults to true
. If false will ignore files during cleanup.directories
- true
/false
Defaults to true
. If false will ignore directories during cleanup.sort_by
- :atime
/:ctime
/:mtime
Defaults to :mtime
. Sort the files to be deleted by their (a)ccess, (c)reate or (m)odified time.keep_last
and older_than
are mutally exclusive since I can't think of any way combining them makes sense.
keep_last
- Takes an integer. Will keep that many files starting from the most recent.older_than
- Takes a hash that looks like {:time_increment => time_quantity}
. Increments can be one of [:minutes, :hours, :days, :weeks] (months are hard).Include the cookbook then just call the cleanup
resource from your recipe like this:
nup "/your/path/here/*" do
ep_last 5
nup "/your/path/here/*" do
der_than :weeks => 1