Richard
Richard

Reputation: 8935

Windows xcopy 0 File(s) copied

I am trying to copy a directory but get the following:

xcopy ..\node_modules\ \node_modules\ 

0 File(s) copied

I run as administrator, but still get the error. Any ideas please?

p.s I actually use the following to stipulate it's a directory. But the above also fails:

echo d | xcopy /d /y ..\node_modules\ \node_modules\

Thanks

enter image description here

enter image description here

Upvotes: 1

Views: 12205

Answers (3)

Nabeel Shaikh
Nabeel Shaikh

Reputation: 1330

To copy all the contents like folder, sub-folder or chain of folders we can use below command:

xcopy file-to-copy-path\ where-to-copy-path\ /s /i

/s copies folders and sub-folders

/i If in doubt always assume the destination is a folder e.g. when the destination does not exist.

Upvotes: 0

FloatingKiwi
FloatingKiwi

Reputation: 4506

You can use the xcopy /E flag to copy the entire directory and subdirectories. Also remove the starting \ of the destination. The trailing slash should prevent the file or directory prompt.

xcopy /E ..\node_modules node_modules\ 

Upvotes: 4

Magoo
Magoo

Reputation: 79957

xcopy ..\node_modules\* \node_modules\ 

You are specifying the source directory, but not which files to copy.

Upvotes: 1

Related Questions