-
Notifications
You must be signed in to change notification settings - Fork 774
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
fs.copy is different from 'cp -r' #537
Comments
Dupe of #323; PR welcome to clarify docs. |
wparad
added a commit
to Authress-Engineering/aws-architect.js
that referenced
this issue
Jan 15, 2018
Recursive function which handily and easily solves this problem. No error handling, use at your risk as a starting point. Hope this helps others who come across this library, as it is fantastic and this is a really small sticking point.
|
another workaround const fs = require('fs-extra');
const path = require('path');
const src = './from/here';
const dst = './to'; // will be copied to ./to/here
let newPath = path.join(dst, path.basename(src));
fs.emptyDirSync(newPath);
fs.copySync(src,newPath); |
Repository owner
locked as resolved and limited conversation to collaborators
Sep 1, 2020
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
fs-extra
version: 5.0.0The document in 'docs/copy.md' says
Try this:
There is two folder called 'A' and 'B' like:
If I try
cp -r ./a ./b
, the folder 'B' will be like this:And if i try
fs.copy('./a', './b')
, B will be like:These two command get different result. So i think the description
in the document 'copy.md' is misleading.
I wish you could modify this document, and add some option that could make
fs.copy
achieve the same effect as 'cp -r'.PS: Sorry for my poor English. : )
The text was updated successfully, but these errors were encountered: