After upgrading to version 5.0.1, files cannot be recursively deleted using the syntax 'aaa/**/xxx. md'
liao666brant opened this issue · 1 comments
liao666brant commented
After upgrading to version 5.0.1, files cannot be recursively deleted using the syntax 'aaa/**/xxx. md'
I have tried the following methods.
const { rimrafSync } = require("rimraf");
rimrafSync("packages\\xxx\\src\\*\\README.md");
rimrafSync("packages\\xxx\\src\\**\\README.md");
rimrafSync("packages/xxx/src/*/README.md");
rimrafSync("packages/xxx/src/**/README.md");
The error is as follows.
xxx\node_modules\.pnpm\rimraf@5.0.1\node_modules\rimraf\dist\cjs\src\path-arg.js:45
throw Object.assign(new Error('Illegal characters in path.'), {
I found that the source code mentioned in the error excluded *. Is this syntax not supported in version 5. x?
If so, how can I replace this grammar?
if (platform_js_1.default === 'win32') {
const badWinChars = /[*|"<>?:]/;
const { root } = (0, path_1.parse)(path);
if (badWinChars.test(path.substring(root.length))) {
throw Object.assign(new Error('Illegal characters in path.'), {
path,
code: 'EINVAL',
});
}
}
isaacs commented
Glob parsing is now opt-in.
rimraf('a/**/b/*.txt', { glob: true })