Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Recursive filesystem utilities

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 index.js
Octocat-spinner-32 package.json
README.md

Build Status

A collection of recursive filesystem utilities.

Installation

npm install recur-fs

Usage

var fs = require('recur-fs');

fs.indir('/some/directory', '/some/directory/file.js');
// Gather all files ending in '.js'
fs.readdir('/some/directory', /\.js$/, null, function(err, files, directories) {
  // Do something with 'files'
});
// Gather all files not ending in '.css'
fs.readdir('/some/directory', null, /\.css$/, function(err, files, directories) {
  // Do something with 'files'
});
// Make a directory and any missing parents (mkdir -p)
fs.mkdir('/some/directory', function(err) {
  // Do something
});
// Move a file to a new destination, calling mkdir if necessary
fs.mv('/some/file', '/some/destination', function(err, newfilepath) {
  // Do something with 'newfilepath'
});
// Copy a file to a new location (cp -r)
fs.cp('/some/file', '/some/destination', function(err, newfilepath) {
  // Do something with 'newfilepath'
});
// Copy the contents of a directory to a new location
// (note trailing slash)
fs.cp('/some/directory/contents/', '/some/destination', function(err, newdestination) {
  // Do something with 'newdestination'
});
// Delete a directory and all subdirectories (rm -rF)
fs.rm('/some/directory/and/children', function(err) {
  // Do something when complete
});

Something went wrong with that request. Please try again.