question

RobM8526-7489 avatar image
0 Votes"
RobM8526-7489 asked jiayaozhu-MSFT commented

XCOPY is not copying subfolders

XCOPY is not copying subfolders even though I am using the parameters /S /C.

I'm also using /D to just update the data. I've tried using /C to ignore errors. And I've tried using ROBOCOPY but I can not get the subfolders copied.

I've tried to contact HP, but they said it was a software issue, even though it (the batch file) worked on my old Win7 machine and on other peoples Win10 machines.

Sample command:

xcopy "C:\Users...\Documents\SystemFiles\" "D:\NewWork\SystemFiles\" /s /e /d /c

Testing that I used:

 ROBOCOPY doesn't work either.
 Testing on folders without spaces was done as well.
 Caps were tested for the parameters.
 COPYIT bat example from the MS site was tried too. It said that Cntl-C was pressed which did not occur.
windows-server-backup
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi,

I would like to check if the reply could be of help? If yes, please help accept answer, so that others meet a similar issue can find useful information quickly. If you have any other concerns or questions, please feel free to feedback.

Best Regards,
Joan

0 Votes 0 ·

1 Answer

jiayaozhu-MSFT avatar image
0 Votes"
jiayaozhu-MSFT answered

Hi,

Thank you for your posting!

Firstly, there are a couple of things I would like to check:

1) were there any error codes or messages popping up after you typed the command, or what exactly happened after you tried to backup your files?

2) Does this issue only occur when you copied the entire subdirectory? Can you try to conduct a single file backup (a file in your subdirectory) with xcopy commands?

Secondly, I suggest you to try these tips to troubleshoot and resolve your issue:

1) Check if you have any permission issue when trying to open both your source and destination path

2) Check your use of your commands correctly again and use the ErrorLevel parameter to process exit codes returned by xcopy, and then you can check the descriptions for relevant exit codes to troubleshoot your issue. You can conduct this process by the guidance from this article:

https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/xcopy

3) Change to use copy commands instead of xcopy. I have seen one who solve her issue by this way.

4) The documentation says that it copies all files and subdirectories from the source directory (meaning that the parent directory is not created), so you would have to create a folder in destination location first and then use XCOPY.

In addition, I found an article that may be helpful to better understand xcopy, rebocopy and copy. So you may find the possible causes and solutions:

https://superuser.com/questions/206036/commmand-line-command-to-copy-entire-directory-including-directory-folder-to-a/1004069

Please note: Information posted in the given link is hosted by a third party. Microsoft does not guarantee the accuracy and effectiveness of information.

Thank you for your support!

Best regards
Joan


If the Answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.