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

copySync Cannot Copy Documents Folder on Windows #726

Closed
danielehrhardt opened this issue Oct 2, 2019 · 11 comments
Closed

copySync Cannot Copy Documents Folder on Windows #726

danielehrhardt opened this issue Oct 2, 2019 · 11 comments

Comments

@danielehrhardt
Copy link

  • Operating System:
    Windows 10 Pro 64 bit
  • Node.js version:
    v10.16.0
  • fs-extra version:
    v8.1.0

If i use copy or copySync to copy the Documents Folder on Windows i get the following Error:

RROR Error: Uncaught (in promise): Error: EPERM: operation not permitted, symlink 'C:\Users\daniel.ehrhardt\Pictures' -> 'C:\temp\Eigene Bilder'
Error: EPERM: operation not permitted, symlink 'C:\Users\daniel.ehrhardt\Pictures' -> 'C:\temp\Eigene Bilder'

My User is a AD User.
My Command:
copySync('C:\\Users\\daniel.ehrhardt\\Documents', 'C:\\temp');

I do not Understand why, the folder Pictures is not in the Documents Folder.

@RyanZim
Copy link
Collaborator

RyanZim commented Oct 2, 2019

That does seem weird. First off, you command is incorrect, if you're copying Documents to temp, you probably want it copied to C:\temp\Documents, you need to put that explicitly in the destination.

@danielehrhardt
Copy link
Author

That does seem weird. First off, you command is incorrect, if you're copying Documents to temp, you probably want it copied to C:\temp\Documents, you need to put that explicitly in the destination.

Same Problem with C:\temp\Documents
Could you reproduce it?

@Inve1951
Copy link

Those are not actual folders but Windows "Libraries". They are gruesome to deal with in many situations and as such should be avoided IMO.

Some reading material: https://docs.microsoft.com/en-us/windows/client-management/windows-libraries

@danielehrhardt While i haven't tested this I guess that your command tries to copy the symlink (if it even is one) to /temp. You can try to use {dereference: true} as a third argument or copy each contained file/folder separately.

In the event that you do want to copy/create symlinks you'll need the SECreateSymbolicLinkPrivilege privilege. (The Administrators AD group has that by default already.)

@brody4hire
Copy link

In the event that you do want to copy/create symlinks you'll need the SECreateSymbolicLinkPrivilege privilege.

I think it should be possible to create junction symlinks on Windows without administrators priv, see discussion in #626 /cc @oliversalzburg

@Inve1951
Copy link

Inve1951 commented Dec 27, 2019

@brodybits I don’t know about junctions but you do need said privilege for regular directory symlinks.

Edit: Also note that the privilege is not exlusive to administrators but can be assigned to any SID.

@danielehrhardt
Copy link
Author

Yes, the Problem are the junctions
image

@danielehrhardt
Copy link
Author

You can try to use {dereference: true}

Is also not working

@RyanZim
Copy link
Collaborator

RyanZim commented Jan 30, 2020

You're best off using Windows native utilities for copying these core directories.

@RyanZim RyanZim closed this as completed Jan 30, 2020
@danielehrhardt
Copy link
Author

You're best off using Windows native utilities for copying these core directories.

This is how you fix Problems?

@RyanZim
Copy link
Collaborator

RyanZim commented Jan 30, 2020

Node.js itself has very poor support for the various kinds of symlinks on Windows. If you want to dig in, find the problem, and submit a PR, you're welcome to. I cannot dedicate time to this.

@oliversalzburg
Copy link

oliversalzburg commented Jan 31, 2020

Just FYI, NodeJS is not able to distinguish a junction from other types of links on Windows. I implemented https://github.com/oliversalzburg/is-junction to work around this issue and solve it in our world.

My attempts to have this integrated into NodeJS was just met by grumpy developers/maintainers who did not see the point apparently.

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

5 participants