Compress specific files in grunt

51 views Asked by At

I am trying to compress few files in a folder and avoid files that are not required,

Structure:

    MainFolder-
    File1
    File2
    File3
    SubFolder1WithFilesInside
    SubFolder2WithFilesInside
    FolderToStoreZip

So I create an array

filesToPutInZip = [ 'MainFolder/File1', 'MainFolder/File2', 'MainFolder/SubFolder1WithFilesInside/**']

and called grunt compress

    compress:{
        main: {
            options:{
                archive: './FolderToStoreZip/final.zip',
                mode: 'zip'
            }
            src: filesToPutInZip
        }
    }

It gives me a zip file with MainFolder inside it.

So I also tried with cwd

    compress:{
        main: {
            options:{
                archive: './FolderToStoreZip/final.zip',
                mode: 'zip'
            }
            cwd: 'MainFolder/'
            src: filesToPutInZip
        }
    }

but it gives me an empty zip file.

And if I try to src MainFolder/** it will take all the files and folder

0

There are 0 answers