-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Rob Ballou edited this page Feb 24, 2015
·
1 revision
Rotatelib is a tool meant to make it easier to deal with cleaning up or acting on files/things that have a date in the name.
This example will remove items in the current directory that:
- start with the string "db"
- are from before 7 days ago
- ignoring the first item per day from the returned files.
var rotatelib = require('js-rotatelib');
var params = {
directory: ".",
startswith: "db",
before: "-7 days",
except_first: "day"
};
rotatelib
.list(params)
.then(function(items) {
rotatelib.removeItems(items, params)
.then(function() {
var plural = items.length !== 1 ? 's' : '';
console.log('Removed ' + items.length + ' item' + plural);
});
});