-
-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when glob matches directory #10
Comments
Or did you expect, that |
OK, the |
I ran into the same issue. I think |
@pgilad It would be the easiest to support this feature within |
@sindresorhus, @kevva: What do you think? |
Or, even better:
|
I don't like how a trailing |
@sindresorhus:
My last suggestion is the same @conradz already suggested, which I hadn't thoroughly thought out: But I do not know whether this makes sense: The following would neither copy a single file nor throw an error: cpy(['node_modules'], 'dist', …) // same as `mkdir dist/node_modules` Comparing the behavior of $ cp node_modules dist
cp: omitting directory 'node_modules'
$ echo $?
1
$ cp --recursive node_modules/ dist
$ echo $?
0 But I think it is not worth it. Especially in combination with globbing, cpy(['**/node_modules'], …, {recursive: true}, …)
// apply cp-file by means of eachAsync to:
// 'node_modules',
// 'node_modules/globby/node_modules',
// … |
As a user it would make sense that I wonder how the behaviour of |
|
Things have changed, today @sindresorhus Hence, I would like to implement a |
👍 Go for it :) |
It turns out, that a @sindresorhus If the following behavior is acceptable, then the things will become much easier: $ tree
.
└── src
└── index.js
$ cpy --recursive 'src' '!**/*.js' 'dest'
$ tree
.
├── dest
│ └── index.js
└── src
└── index.js I think that this is reasonable; it's similar to |
I don't get it. In your example |
I can think of two ways how negative patterns can have an effect in in conjunction with $ tree
.
└── src
└── index.js
└── index.css
cpy --recursive 'src' '!**/*.js' 'dest'
# equals to
cpy --recursive 'src' 'dest'
# => also copies 'src/index.js' to 'dest'
cpy --recursive 'src' '!**/*.js' 'dest'
# equals to
cpy 'src' 'src/index.css' 'dest'
# => does not copy 'src/index.js' to 'dest' The first one is similar to |
Related issue: sindresorhus/cpy-cli#10 (comment) |
Currently it throws an error (EISDIR) when the glob matches a directory. I want to copy all files and directory structure to another directory. I am using
cpy(['**/*'], '../output/dist', { cwd: 'assets', parents: true }, cb);
. This does not work since**/*
also matches the directory names.I could make a PR to fix this if you know what behavior we should have. Should we just ignore empty directories or create them? I'm currently leaning toward creating any directories, which I think is the most intuitive.
The text was updated successfully, but these errors were encountered: