AvianFlu / ncp

Asynchronous recursive file copying with Node.js.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Filter

Evaske opened this issue · comments

I think your filter script might be slightly wrong. Tested using the following REGEXP:

/package/i

Against the following /package.json. It still copies it over. After looking in to the NCP script I believe it should be the following, which works:

if (filter.test(source)) {

from line 38 of ncp.js

Unless I'm completely missing the way the filter is supposed to work?

+1 I feel the filter is currently inversed

+1
filter fails

Bump. Filter definitely not working. Its compounded by not having any tests or examples to look at usage. Inverting regex is very difficult / inefficient and when that is combined with the number of characters that need to be escaped on various shells, filter is not usable at command line at the moment.

+1
copies everything, filter not working

(function() {
    'use strict';

    var ncp  = require('ncp').ncp,
        src  = './src',
        dest = './dest',
        opts = {
            filter: '([^\\s]+(\\.(?i)(pdf))$)'
        };

    ncp.limit = 50;

    ncp(src, dest, opts, function(err) {
        if(err) {
            return console.log(err);
        } else {
            return console.log('done');
        }
    });

})();