How to target all files in root folder and subfolders except some in Grunt

287 views Asked by At

I'm trying to archive all files (including subfolders and files in them) in the root folder with some exceptions.

Here's the list of the files:

 var fileList = [
    '**/*',
    '!archive.zip',
    '!.sass-cache/*',
    '!assets/*',
    '!node_modules/*',
    '!.bowerrc',
    '!.editorconfig',
    '!.gitattributes',
    '!.gitignore',
    '!.jshintrc',
    '!bower.json',
    '!Gruntfile.js',
    '!package.json',
    '!README.md',
    '!sublime.sublime-project',
    '!sublime.sublime-workspace',
  ];

And here's the grunt-contrib-compress config:

    compress: {
      main: {
        options: {
          archive: 'archive.zip'
        },
        files: [
          { src: [fileList], dest: 'archive/' }, // includes files in path
        ]
      }
    }

But I can't make it work. Seems that the process is stuck in endless loop and it keeps archiving itself over and over. I tried adding the name of the archive to the exception list, however it didn't help.

How can I get all the files archived from the root folder and subfolders with certain exceptions?

Thanks a lot.

0

There are 0 answers