Filesystem.cp()

Copy file or directory located at source path to the destination path (overwriting an existing file at the destination path, if there is one).

Includes all of its descendant files and directories (i.e. `cp -r`).

Usage

Hover over inputs/exits for more info.

var Filesystem = require('machinepack-fs');


// Copy file or directory located at source path to the destination path (overwriting an existing file at the destination path, if there is one).

Filesystem.cp({

source: '/Users/mikermcneil/.tmp/foo',

destination: '/Users/mikermcneil/.tmp/bar',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// No file or folder exists at the provided souce path.

doesNotExist: function () {

 

},

// OK.

success: function () {

 

},

});

Inputs

source required

The path (relative or absolute) to the file or directory to copy.

'/Users/mikermcneil/.tmp/foo'
destination required

The path (relative or absolute) to the directory in which to place the copied file(s). When copying a single file, a target filename may be specified.

'/Users/mikermcneil/.tmp/bar'

Exits

error

An unexpected error occurred.

doesNotExist

No file or folder exists at the provided souce path.

success

OK.