Share via

Why robocopy only copy directories but not files?

Anonymous
2023-07-11T06:12:55+00:00

I've tried robocopy to directories of programs,

However, when I see the consequences, only directories were copied but program files weren't copied.

But when I pick exe files to copy, then it is copied

Why is that, and is there any way to solve this?

Here is the command I used

robocopy "c:\source" "e:\destination" a b c d /e /copy:dat

+

There are a, b, c, d, e, f directories with several files in c:\source, I just wanted to copy a, b, c, d, so I typed that, and got only directories,

What is interesting is, even if I type only a to copy after the failure,

robocopy "c:\source" "e:\destination" a /e /copy:dat

with that command, still 4 of folders I just failed copied.

This must be involved with that.

Windows for home | Windows 10 | Files, folders, and storage

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

15 answers

Sort by: Most helpful
  1. Anonymous
    2023-08-31T12:17:27+00:00

    The reason why only the directories were copied when you used the command robocopy "c:\source" "e:\destination" a b c d /e /copy:dat is because the /copy:dat switch tells Robocopy to copy only the Data and Attributes of folders. To copy all files, including program files, you need to use the /copy:datsou switch.

    The /copy:datsou switch tells Robocopy to copy all file attributes, including NTFS security permissions. This will also copy all files, including program files.

    The command you used to copy only the directory a also included the /e switch, which tells Robocopy to copy subdirectories, including empty ones. This is why the other directories were also copied.

    To copy only the directory a and its contents, you can use the following command:

    robocopy "c:\source" "e:\destination" a /copy:datsou

    <removed>

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Ivan B 114.8K Reputation points Independent Advisor
    2023-07-12T18:36:23+00:00

    Hi , 1614.

    You can put a line of each command it will execute the other one when the first one ends using @echo

    however you can use time out by putting the amount of seconds.

    I recommend you check with the Social Tech Microsoft community there, they can help you better about this.

    https://social.technet.microsoft.com/Forums/en-...

    Independent Advisor - Community

    Thanks

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  3. Ivan B 114.8K Reputation points Independent Advisor
    2023-07-11T20:41:52+00:00

    Hi , 1614.

    And that's what I mean, but you can use it in sequence as I reported:

    robocopy c:\folder\a d:\folder *.* /E /DCOPY:DAT /R:5 /W:1

    robocopy c:\folder\b d:\folder *.* /E /DCOPY:DAT /R:5 /W:1

    robocopy c:\folder\c d:\folder *.* /E /DCOPY:DAT /R:5 /W:1

    If you put it in a bat file you can put the wait command for each process.

    Independent Advisor - Community

    Thanks

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  4. Ivan B 114.8K Reputation points Independent Advisor
    2023-07-11T13:51:46+00:00

    Hi , 1614.

    You can put the origin and destination of the specific folders and run the command in sequence for each folder, but you specify a copy of a folder inside another, I think it doesn't work at least for the line of information

    https://learn.microsoft.com/en-us/windows-serve...

    You can copy specific extensions or security levels by size, among others. however specific folder beyond the destination I think not.

    Independent Advisor - Community

    Thanks

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  5. Ivan B 114.8K Reputation points Independent Advisor
    2023-07-11T09:34:42+00:00

    Hi , 1614.

    I am Ivan, I will help you with this.

    Try is on Command:

    robocopy “C:\Origem” “D:\Destino” /E /COPYALL

    Independent Advisor - Community

    Thanks

    Was this answer helpful?

    0 comments No comments