Php

ファイルとフォルダを一気に削除する



Gulp Delete Files Folders



1.モジュールをインストールします

npm i gulp del --save-dev

2.プロジェクトのルートディレクトリに新しいgulpfile.jsファイルを作成します



import { task, src, dest, watch, series } from 'gulp' Import del from 'del' //delete files and folders / / Delete files and folders task('testClean', async () => { del([ 'dist/report.csv', //Here we use a wildcard pattern to match everything in the `mobile` folder 'dist/mobile/**/*.js', //We don't want to delete this file, so we reverse this match pattern '!dist/mobile/deploy.json' ]) })

最後に、report.csvおよびmobileの下にあるすべてのjsファイルが削除され(フォルダーは含まれません)、deploy.jsonが保持されます。