Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to copy a Users Directory with XCOPY, but parts of it are not working.

(I'm running as Administrator, in a command prompt which was started with Run As Administrator)

The user directory looks like: (abbreviated)

> dir /a /q
05/18/2014  05:42 PM    <DIR>          MyPC\JoeBob            AppData
05/18/2014  05:42 PM    <JUNCTION>     NT AUTHORITY\SYSTEM    Application Data [C:\Users\JoeBob\AppData\Roaming]
05/18/2014  05:42 PM    <DIR>          MyPC\JoeBob            Contacts
05/18/2014  05:42 PM    <JUNCTION>     NT AUTHORITY\SYSTEM    Cookies [C:\Users\JoeBob\AppData\Roaming\Microsoft\Windows\Cookies]
05/18/2014  05:42 PM    <JUNCTION>     NT AUTHORITY\SYSTEM    Local Settings [C:\Users\JoeBob\AppData\Local]
05/18/2014  05:42 PM    <DIR>          MyPC\JoeBob            Music
05/18/2014  05:42 PM    <JUNCTION>     NT AUTHORITY\SYSTEM    My Documents [C:\Users\JoeBob\Documents]
05/18/2014  05:42 PM    <JUNCTION>     NT AUTHORITY\SYSTEM    NetHood [C:\Users\JoeBob\AppData\Roaming\Microsoft\Windows\Network Shortcuts]
05/18/2014  09:31 PM           786,432 MyPC\JoeBob            NTUSER.DAT
05/18/2014  09:31 PM           262,144 NT AUTHORITY\SYSTEM    ntuser.dat.LOG1
05/18/2014  05:42 PM                 0 NT AUTHORITY\SYSTEM    ntuser.dat.LOG2
05/18/2014  09:31 PM            65,536 NT AUTHORITY\SYSTEM    NTUSER.DAT{016888bd-6c6f-11de-8d1d-001e0bcde3ec}.TM.blf
05/18/2014  09:31 PM           524,288 NT AUTHORITY\SYSTEM    NTUSER.DAT{016888bd-6c6f-11de-8d1d-001e0bcde3ec}.TMContainer00000000000000000001.regtrans-ms
05/18/2014  09:31 PM           524,288 NT AUTHORITY\SYSTEM    NTUSER.DAT{016888bd-6c6f-11de-8d1d-001e0bcde3ec}.TMContainer00000000000000000002.regtrans-ms

Note that:

  • Some of the directories are really junctions (aka. symlinks / reparse points)
  • The junctions have owner NT AUTHORITY\SYSTEM.

When I run the command:

xcopy C:\Users\JoeBob\*.* E: /O/X/E/H/K/B

the various switches are supposed to do:

  • /O - Copy Ownership info
  • /B - Copy Symlink

But when I actually do the copy, and view the results at the destination E:, all the Junctions have become real directories, and have owner BUILTIN\Administrators

It seems that switches /O and /B both failed.
But I cannot find any mention that those switches don't work for SYSTEM-owned junctions.

Am I missing something? Is there a good fix or workaround for this?

share|improve this question
    
Note that Run as Administrator is not the same as Run as System. I can't answer with certaincy why this is failing, but I would assume it is due to it being owned by SYSTEM. –  LPChip May 25 at 14:48
    
Nope: I changed the owner of one of the Junctions to be my Admin-user, and repeated the copy: The junction still became a Directory, and still had owner BUILTIN\Administrators –  abelenky May 25 at 15:02
1  
"junctions (aka. symlinks / reparse points)" Those are not the same thing. –  CodesInChaos Jun 7 at 12:00

1 Answer 1

I think your mixing a directory Symbolic link with directory Junction.

A directory Junction is very different from a directory symbolic link (Symlink). XCOPY does copy Symlinks correctly (with /B) but it can't handle directory Junctions. (See an explanation of all these types here)

You can copy the directory with Robocopy and exclude the directory Junctions (with /XJ) but then you don't have those junctions in your backup. You could Google for it: windows copy junction points.

This way i found this topic with a possible solution of using the tool FastCopy which would preserve the junction points.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.