Socket
Book a DemoInstallSign in
Socket

dirkeeper

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dirkeeper

Prune a directory to contain a set number of sub-directories, retention policy is recency

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
5
25%
Maintainers
2
Weekly downloads
 
Created
Source

dirkeeper

Prune a directory to contain a set number of sub-directories, retention policy is recency. That is to say, oldest sub-directories are pruned first.

Installation

npm install dirkeeper

Usage


var keeper = require('dirkeeper')


// You wish to make '/myDir' only contain the 5 newest sub-directories

keeper({count: 5, baseDir: '/myDir'}, function(err) {
  if (err) throw err
  console.log("pruned")
})


A count of 0 means prune all sub-directories:


var keeper = require('dirkeeper')


// You wish to make '/myDir' contain no sub-directories:

keeper({count: 0, baseDir: '/myDir'}, function(err) {
  if (err) throw err
  console.log("pruned everything")
})


Additionally, a count >= the actual number of sub-directories means prune nothing.

Tests

Run npm test

License

BSD

Keywords

filesystem

FAQs

Package last updated on 24 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts