Anagha
Anagha

Reputation: 21

Unable to Copy folders using Copy command from a remote windows machine

I tried to copy a folder from a remote machine to the base machine using copy command,but only the files seems to be copying. The folders are not getting copied. Below is the piece of command I used to copy the "src_folder" folder in the remote machine to the "dest_folder" folder in the base machine.

net use \\xx.xx.xx.xx\c$\ password /user:username
copy \\xx.xx.xx.xx\c$\src_foldername C:\dest_foldername

Please help me in resolving this issue. Thanks in advance.

Upvotes: 1

Views: 1649

Answers (2)

mr R
mr R

Reputation: 1126

Try XCOPY in CMD https://support.microsoft.com/en-us/kb/240268

xcopy \\xx.xx.xx.xx\c$\src_foldername\*.* C:\dest_foldername\ /s /e

/s for copy folders and subfolders without empty folders

/e Copy empty subfolders

Upvotes: 0

Anagha
Anagha

Reputation: 21

Got the solution :

net use \\xx.xx.xx.xx password /user:username
xcopy \\xx.xx.xx.xx\c$\src_folder C:\dest_folder /s /e /y /i

where:

/s : Copies directories and subdirectories, unless they are empty
/e : Copies all subdirectories, even if they are empty
/y : Suppresses prompting to confirm that you want to overwrite an existing destination file
/i : If Source is a directory or contains wildcards and Destination does not exist, xcopy assumes destination specifies a directory name and creates a new directory.

The above command works.

Upvotes: 1

Related Questions