Skip to content
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

Moving with glob pattern fails on Windows but works fine on Linux #226

Open
t00 opened this issue Dec 16, 2024 · 3 comments
Open

Moving with glob pattern fails on Windows but works fine on Linux #226

t00 opened this issue Dec 16, 2024 · 3 comments

Comments

@t00
Copy link

t00 commented Dec 16, 2024

I have a part of a script which copies playwright tests artifacts from a temporary folder to a permanent one. The purpose is to copy all subdirectories from the test-results/ directory to the results/ directory.

shx mv test-results/** results/

When running on Linux it does not output anything and copies directories as expected.

On Windows it throws the following error:

mv: no such file or directory: test-results/playwright-8247-monitor-co-76a6b-or---Connections-tab-8247-1-Chrome-Stable
mv: no such file or directory: test-results/playwright-8247-monitor-co-76a6b-or---Connections-tab-8247-1-Chrome-Stable/test-failed-1.png
mv: no such file or directory: test-results/playwright-8247-monitor-co-76a6b-or---Connections-tab-8247-1-Chrome-Stable/test-failed-10.png
mv: no such file or directory: test-results/playwright-8247-monitor-co-76a6b-or---Connections-tab-8247-1-Chrome-Stable/test-failed-11.png
mv: no such file or directory: test-results/playwright-8247-monitor-co-76a6b-or---Connections-tab-8247-1-Chrome-Stable/test-failed-12.png
mv: no such file or directory: test-results/playwright-8247-monitor-co-76a6b-or---Connections-tab-8247-1-Chrome-Stable/test-failed-13.png
mv: no such file or directory: test-results/playwright-8247-monitor-co-76a6b-or---Connections-tab-8247-1-Chrome-Stable/test-failed-14.png
mv: no such file or directory: test-results/playwright-8247-monitor-co-76a6b-or---Connections-tab-8247-1-Chrome-Stable/test-failed-15.png
mv: no such file or directory: test-results/playwright-8247-monitor-co-76a6b-or---Connections-tab-8247-1-Chrome-Stable/test-failed-16.png
mv: no such file or directory: test-results/playwright-8247-monitor-co-76a6b-or---Connections-tab-8247-1-Chrome-Stable/test-failed-2.png
mv: no such file or directory: test-results/playwright-8247-monitor-co-76a6b-or---Connections-tab-8247-1-Chrome-Stable/test-failed-3.png
mv: no such file or directory: test-results/playwright-8247-monitor-co-76a6b-or---Connections-tab-8247-1-Chrome-Stable/test-failed-4.png
mv: no such file or directory: test-results/playwright-8247-monitor-co-76a6b-or---Connections-tab-8247-1-Chrome-Stable/test-failed-5.png
mv: no such file or directory: test-results/playwright-8247-monitor-co-76a6b-or---Connections-tab-8247-1-Chrome-Stable/test-failed-6.png
mv: no such file or directory: test-results/playwright-8247-monitor-co-76a6b-or---Connections-tab-8247-1-Chrome-Stable/test-failed-7.png
mv: no such file or directory: test-results/playwright-8247-monitor-co-76a6b-or---Connections-tab-8247-1-Chrome-Stable/test-failed-8.png
mv: no such file or directory: test-results/playwright-8247-monitor-co-76a6b-or---Connections-tab-8247-1-Chrome-Stable/test-failed-9.png
ERROR: "playwright:run2:8247" exited with 1.

I am using forward slashes on both but possibly on Windows these are not handled the same way?

@t00
Copy link
Author

t00 commented Dec 16, 2024

I just changed the command to shx cp -r test-results/* results/ and the contents are copied correctly. This suggests some globbing pattern emulation differences on Windows.

@nfischer
Copy link
Member

Why not just try shx cp -r test-results/ results/? You should run this before the results folder is created. This command will then create results/ and all of its sub directories will match the subdirectories of test-results/.

No need for glob expressions and it's a lot simpler. Let me know if I've misunderstood your goal.

@nfischer
Copy link
Member

Regarding glob expressions, please read https://github.com/shelljs/shx#packagejson (the globbing guidance applies whether it's in package.json or not—I should refactor that guidance into a new section of the documentation).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants