javascript - What's the difference between dir/* , dir/**, dir/**/* , dir/**/*.* in globbing? -
javascript - What's the difference between dir/* , dir/**, dir/**/* , dir/**/*.* in globbing? -
imagine next directory structure:
web/ sub1/ 1.js 3.js when utilize 'del' node module delete file or directory, behavior of dir/* , dir/**, dir/**/*, dir/**/*.* different.
web/* del(['web/*', '!web/sub1/1.js']) -> under web/ removed, web/sub1/1.js removed well del(['web/*', '!web/3.js']}) -> under web/ removed except 3.js keeped
web/** del(['web/**', '!web/sub1/1.js']), del(['web/**', '!web/3.js']) -> result of 2 forms same, web/ removed
web/**/* del(['web/**/*', '!web/sub1/1.js']) -> under web/ removed del(['web/**/*', '!web/3.js']}) -> under web/ removed except 3.js keeped
web/**/*.* del(['web/**/*.*', '!web/sub1/1.js']) -> files under web/ removed except web/sub/1.js , directory construction keeped del(['web/**/*.*', '!web/3.js']}) -> files under web/ removed except 3.js , directory construction keeped
after done above test, i'm totally confused, can't summarize rule out of above test. , can't find detailed documentation explaining these. can help here??
node del uses node-glob matching targets , rimraf removing matched targets. matched targets passed rimraf , rimraf remove file or remove directory recursively. reply question targets matched patterns.
web/*
all kid items matched: web/sub1, web/3.js. removed, !web/sub1/1.js not exclude anything. !web/3.js excludes file, web/sub1 removed recursively.
web/**
the directory , nested items matched: web, web/sub1, web/sub1/1.js, web/3.js. because directory removed recursively files exclusions not efficient.
web/**/*
all nested items matched: web/sub1, web/sub1/1.js, web/3.js. web/sub1 removed recursively , exclusion !web/sub1/1.js not matter. exclusion !web/3.js keeps file.
web/**/*.*
only nested files matched: web/sub1/1.js, web/3.js. no directories removed , exclusion of file keeps it.
javascript gulp globbing
Comments
Post a Comment