Can't exclude directories using src glob
See original GitHub issueI can’t exclude a directory from being copied over when using a src glob. Here’s my task:
gulp.task('copy', function() {
return gulp.src(['app/**', '!app/_tmp/**'])
.pipe(gulp.dest('dist'));
});
Gulp copies over app/**
, but app/_tmp/
is still being copied.
Expected:
+ app/
+ tmp/
file1
file2
+ css/
styles.css
+ js/
app.js
+ dist/
+ css/
styles.css
+ js/
app.js
Gulp output:
+ app/
+ tmp/
file1
file2
+ css/
styles.css
+ js/
app.js
+ dist/
+ tmp/
+ css/
styles.css
+ js/
app.js
Update: Clarified that the dist/_tmp/
directory does not contain any files
Issue Analytics
- State:
- Created 10 years ago
- Comments:28 (9 by maintainers)
Top Results From Across the Web
gulp.src() include files but ignore all folders - Stack Overflow
What globbing pattern to include all the files in a folder but ignore ALL subfolders? gulp.src('*') includes all files and folders. I just...
Read more >rsync exclude directory not working - Unix Stack Exchange
FYI my issue was using the list syntax --exclude={'landing','studio'} and I had a space after the , . The list must not contain...
Read more >Exclude Directory-Pattern in gulp with glob in `gulp.src`
ay you have a folder project/src that contains the following files:. “Exclude Directory-Pattern in gulp with glob in `gulp.src`” is published by jack.yin....
Read more >Working With Files - Gradle User Manual
You can include files in subdirectories by using an Ant-style glob pattern ... fileTree(dir: 'src/main') // Add include and exclude patterns to the...
Read more >glob - npm
nodir Do not match directories, only files. (Note: to match only directories, simply put a / at the end of the pattern.) ignore...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@aaronbushnell
why?
!app/_tmp
would match only the folder, but not any file within it - since it’s not a globbing expression (a bug?)!app/_tmp/**
would match the files IN the_tmp
folder, but not the folder itself, so the empty folder would be createdusing the
!app/{_tmp,_tmp/**}
pattern uses a pattern to combine the both requirements and says:😃
The way I’ve made this work is to exclude the directory and the contents like so:
gulp.src(['app/**', '!app/_tmp', '!app/_tmp/**'])