Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to remove everything with rimraf except few exceptions

Tags:

node.js

rm

i’m trying to remove all .dot files, except .git and all *.js except one exception.js, but i’m failing

install

git clone [email protected]:iamstarkov/rimraf-test.git
cd rimraf-test

test

npm test # it fails

can anybody help me?

like image 506
Vladimir Starkov Avatar asked Dec 20 '15 23:12

Vladimir Starkov


1 Answers

var globby = require('globby');
var rimraf = require('rimraf');

globby(['*', '!authors.js', '!.git', '!dump'])
  .then(function then(paths) {
    paths.map(function map(item) {
      rimraf.sync(item);
    });
  });
like image 54
Vladimir Starkov Avatar answered Nov 15 '22 05:11

Vladimir Starkov