sindresorhus / cpy

Copy files
MIT License
425 stars 63 forks source link

wildcard vs explicit paths have different output #105

Open sndrs opened 2 years ago

sndrs commented 2 years ago

given the following file structure:

src/
├── hello-world.js
└── README.md

running the following with 9.0.1:

cpy([
  'src/*.md', 
  'src/hello-world.js'
], 'dist')

creates:

dist/
├── src/
│   └── hello-world.js
└── README.md

Apologies if I misunderstood, but is this expected?

I would expect both globs to create the same out structure.

example here: https://replit.com/join/obiaxjzgca-sndrs

sindresorhus commented 2 years ago

That does indeed look like a bug.

sindresorhus commented 2 years ago

// @Idered

dls314 commented 2 years ago

Possibly related, there seems to be a difference between windows/nix when cpy-cli reuses cpy that is similar in expression to this bug. That is, when globs are used, on nix the output includes the directory (like src above) unless the --flat flag is used. On windows, no --flat is necessary to prevent it.