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

Copying all files and directories from one dir to another #61

Open
SirwanAfifi opened this issue May 16, 2019 · 19 comments
Open

Copying all files and directories from one dir to another #61

SirwanAfifi opened this issue May 16, 2019 · 19 comments

Comments

@SirwanAfifi
Copy link

I'm using this command to copy all files from build directory to `dist:

copyfiles -u 1 build/* dist

It works fine except it doesn't copy directories, How can we make sure it also copies the directories with files inside recursively?

@calvinmetcalf
Copy link
Owner

try copyfiles -u 1 build/**/* dist

@SirwanAfifi
Copy link
Author

It doesn't work.

@calvinmetcalf
Copy link
Owner

try copyfiles -u 1 "build/**/*" dist and let me know the results

@SirwanAfifi
Copy link
Author

It worked! thanks

@SirwanAfifi
Copy link
Author

Only works on Windows: copyfiles -u 1 build/**/* dist
Only works on macOS: copyfiles -u 1 "build/**/*" dist

@SirwanAfifi SirwanAfifi reopened this May 16, 2019
@calvinmetcalf
Copy link
Owner

what are the issues you get on the different platforms

@SirwanAfifi
Copy link
Author

Nothing happens, it doesn't move the files

@calvinmetcalf
Copy link
Owner

so on windows with the quotes and macOS without the quotes it does nothing ?

@SirwanAfifi
Copy link
Author

That's right.

@kuncevic
Copy link

kuncevic commented Jun 7, 2019

Had similar issue. Have to use quotes to make it work on mac, otherwise won't include any folders

@Diokuz
Copy link

Diokuz commented Jun 7, 2019

Probably flag --source would be more obvious for users.

@calvinmetcalf
Copy link
Owner

@Diokuz not sure what you're replying to..

@hieuhoangtrung
Copy link

Just find a workaround that you can escape the double quote \": copyfiles -u 1 \"build/**/*\" dist
cc @calvinmetcalf @SirwanAfifi

@brettz9
Copy link

brettz9 commented Nov 23, 2019

@hieuhoangtrung : The workaround isn't working for me on the Mac, at least with an npm script (for the sake of JSON, including, before each double quote, two backslashes to represent the backslash and one backslash to escape the double quote). Doing so causes nothing to be copied.

@tvvignesh
Copy link

tvvignesh commented Nov 30, 2019

try copyfiles -u 1 "build/**/*" dist and let me know the results

It would be great if you could add this to the docs. I was using without quotes for close to 1 year and was using some hacks thinking that it was a bug but then, using quotes solved the issue for me now.

To copy all files except *.ts files recursively (with folders) from src to dist folder, I had to do:

npx copyfiles -u 1 -e \"src/**/*.ts\" \"src/**/*.*\" dist/ and then it worked perfectly.

Thanks.

@EliasTouil
Copy link

Only works on Windows: copyfiles -u 1 build/**/* dist
Only works on macOS: copyfiles -u 1 "build/**/*" dist

Hello @SirwanAfifi , Is this still valid?
Is there a workaround that will work on both windows and mac?

@SirwanAfifi
Copy link
Author

@EliasTouil Yes it is valid

@MetaMmodern
Copy link

Hey, we still have this issue open. Any progress?

@stealthrabbi
Copy link

stealthrabbi commented Jul 15, 2021

Only works on Windows: copyfiles -u 1 build/**/* dist
Only works on macOS: copyfiles -u 1 "build/**/*" dist

Hello @SirwanAfifi , Is this still valid?
Is there a workaround that will work on both windows and mac?

I don't have a Mac to test on, but I have found that copyfiles -u 1 "build/**/*" dist works both on Windows and Linux. It's quite possible that that option works on Mac as well. I'm on 2.4.1 of copyfiles, which is the latest at the moment.

I'm not sure what adding the double quotes does. I'm not working with paths that have spaces in them.

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

10 participants