简体   繁体   English

Globby和rimraf应该删除.yml文件以外的所有内容

[英]Globby and rimraf should remove everything except .yml files

The following js code (executed through foundation build) should actually clean the whole folder defined in PATHS.springDist except .yml files, instead it deletes everything. 以下js代码(通过基础构建执行)实际上应清除PATHS.springDist中定义的整个文件夹(.yml文件除外),而是删除所有内容。

function cleanSpring(done) {
    globby([PATHS.springDist + '/*', '!.yml']).then(paths => {
        paths.map(item => {
            rimraf(item, done);
        });
    });
}

What could be wrong? 有什么事吗

I finally found it myself, actually i was in the wrong folder with "!*.yml" This way it's working fine: 我终于自己找到了它,实际上我把“!*。yml”放在错误的文件夹中,这样可以正常工作:

function cleanSpring(done) {
    let path = PATHS.springDist;
    globby([path+ '/**/*', '!' + path + '/*.yml']).then(paths => {
        paths.map(item => {
          rimraf(item, done);
        });
    });
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM