[edit: solved, see answer below]
I would like to run a grunt-contrib-copy task that will copy everything from one directory (a source directory) to another location (a distribution directory) with the exception of one folder. In other words, given the structure:
src
丨- images
丨- favicons/
丨- files.jpg
丨- other folders/
丨- individual_file.png
I would like to move "images" but without the "favicons", producing the following:
dist
丨- images
丨- other folders/
丨- individual_file.png
However, what I am getting is this:
dist
丨- images
丨- favicons (empty)
丨- other folders/
丨- individual_file.png
I have looked at the following questions on SO:
grunt (minimatch/glob) folder exclusion
grunt-contrib-copy - ignore folder when copying
Configure grunt copy task to exclude files/folders
But I am getting something wrong with my syntax. I have used various globbing patterns and the closest success I've had (which works with any number of different globbing patterns) is to create the folder at the destination but without any of the files in it.
Here is what I THINK is more or less the same as the accepted answer in this answer:
imageDist: {
expand: true,
cwd: 'src/images/',
src: ['**/*', '!**/favicons/**'],
dest: 'dist/images/'
}
But it results in an empty "favicons" directory.
Here's at least one more of the many patterns I tried which also results in an empty "favicons" directory. This one makes the most sense to me because I'm saying "copy everything" and then "except favicons". I don't reaaaalllly need globbing for the exclude match, because I KNOW I have a directory called favicons. I have also tried combinations of leading and trailing slashes (without wildcard) on the following:
imageDist: {
expand: true,
cwd: 'src/images/',
src: ['*', '!favicons'],
dest: 'dist/images/'
}