AvianFlu / ncp

Asynchronous recursive file copying with Node.js.
MIT License
680 stars 103 forks source link

Filter #101

Open Evaske opened 8 years ago

Evaske commented 8 years ago

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?

yangli-io commented 8 years ago

+1 I feel the filter is currently inversed

theunexpected1 commented 8 years ago

+1 filter fails

cchamberlain commented 8 years ago

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.

ZachMoreno commented 7 years ago

+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');
        }
    });

})();