sindresorhus / cpy-cli

Copy files
MIT License
344 stars 33 forks source link

Inconsistent file tree depending on OS #47

Open adrien-febvay opened 8 months ago

adrien-febvay commented 8 months ago

Consider the following file tree:

dist-tmp
└── index.html

On Windows, the command npx cpy-cli dist-tmp/** dist/ results in:

dist
└── index.html

On Linux, the same command npx cpy-cli dist-tmp/** dist/ results in:

dist
└── dist-tmp
    └── index.html

It happened using node 18.18.0 on both systems

yukha-dw commented 6 months ago

Using this command should give same results cpy dist-tmp/**/* dist/

dist
└── index.html
adrien-febvay commented 6 months ago

Using this command should give same results cpy dist-tmp/**/* dist/

No, it results in 'cpy' is not recognized as an internal or external command, operable program or batch file.

One of the point of this package is having a cross-platform solution.

zhangyahan commented 5 months ago

I also have the same problem

yukha-dw commented 5 months ago

Using this command should give same results cpy dist-tmp/**/* dist/

No, it results in 'cpy' is not recognized as an internal or external command, operable program or batch file.

One of the point of this package is having a cross-platform solution.

replace cpy with npx cpy-cli if executed directly

adrien-febvay commented 5 months ago

replace cpy with npx cpy-cli if executed directly

The point of this thread is that npx cpy-cli has an inconsistent behaviour depending on the OS you're on, so your answer telling to use it doesn't make any sense as, once again, it is broken.

~Anyway, I just found out that adding /* to the source fixes my issue.~

Scratch my last. The workaround didn't work.

sanjaikumarv commented 1 month ago

Just add single quote on src @adrien-febvay @zhangyahan @yukha-dw , It fixes the issue.

Wrong: npx cpy-cli dist-tmp/** dist/

Right: npx cpy-cli 'dist-tmp/**' dist/

ajiho commented 4 weeks ago

Just add single quote on src @adrien-febvay @zhangyahan @yukha-dw , It fixes the issue.

Wrong: npx cpy-cli dist-tmp/** dist/

Right: npx cpy-cli 'dist-tmp/**' dist/ I spent a lot of time debugging on Windows and Linux, but couldn't find where the error was. Your method is indeed effective

grantwforsythe commented 1 week ago

Just add single quote on src @adrien-febvay @zhangyahan @yukha-dw , It fixes the issue.

Wrong: npx cpy-cli dist-tmp/** dist/

Right: npx cpy-cli 'dist-tmp/**' dist/

@sanjaikumarv's solution did indeed resolve the issue. I am going to try my hand at resolving this issue given that the project is so small and; hopefully, have a fix up by the end of the week.

adrien-febvay commented 1 week ago

Just add single quote on src @adrien-febvay @zhangyahan @yukha-dw , It fixes the issue.

Wrong: npx cpy-cli dist-tmp/** dist/

Right: npx cpy-cli 'dist-tmp/**' dist/

I used double quotation marks because single ones won't work on PowerShell, but other than that, yes it works. Thank you.

{
  "scripts": {
    "postbuild": "npx cpy-cli \"dist-tmp/**\" dist/"
  }
}