I'm manually backing up data off a hard drive that has XP installed on it, because I suspect the drive is failing. I want to copy the files, but I don't want to change the owner (or any permissions) on the original drive, to be able to do so. Is there any way to do this?
Turns out Robocopy can do this incredibly easily. Simply include the
/B option on your command line, to copy files in Backup mode. This requires that you run as Administrator.
My command line:
robocopy /MIR /B "E:\Documents and Settings" "C:\DeadDriveBackup\Documents and Settings"
The given answer did not work for me; this did.
Robocopy has a
/COPY argument used to specify which parts of files to copy. Available to copy are data, attributes, timestamps, security information (NTFS ACLs), ownership information, and auditing information. If you're looking to copy everything in one directory to another perfectly, use this:
robocopy /E /B /COPYALL "C:\One" "C:\Two"
/Ecopies all files, including empty directories. This works like
/MIR, but doesn't delete anything in the destination.
/Bcopies in "backup mode", giving Robocopy the permission to overwrite ACLs (file permissions).
/COPYALLis an alias to
/COPY:DATSOU, which copies all file data, including file ownership and permission (ACL) data.
Are you copying a user profile?
I was, and there are some extra caveats. Default Windows user profiles contain directory junction loops, and Robocopy cannot be configured to create new junctions rather than following them. The above Robocopy command will fail and create difficult-to-remove directory trees, so use this command which will exclude junctions.
robocopy /E /B /COPYALL /XJ "C:\One" "C:\Two"
For compatibility you should probably recreate the default directory junctions in a user profile:
mklink /J "Application Data" "AppData\Roaming" mklink /J "Cookies" "AppData\Local\Microsoft\Windows\INetCookies" mklink /J "Local Settings" "AppData\Local" mklink /J "My Documents" "Documents" mklink /J "NetHood" "AppData\Roaming\Microsoft\Windows\Network Shortcuts" mklink /J "PrintHood" "AppData\Roaming\Microsoft\Windows\Printer Shortcuts" mklink /J "Recent" "AppData\Roaming\Microsoft\Windows\Recent" mklink /J "SendTo" "AppData\Roaming\Microsoft\Windows\SendTo" mklink /J "Start Menu" "AppData\Roaming\Microsoft\Windows\Start Menu" mklink /J "Templates" "AppData\Roaming\Microsoft\Windows\Templates" attrib /L +S +H +I "Application Data" attrib /L +S +H +I "Cookies" attrib /L +S +H +I "Local Settings" attrib /L +S +H +I "My Documents" attrib /L +S +H +I "NetHood" attrib /L +S +H +I "PrintHood" attrib /L +S +H +I "Recent" attrib /L +S +H +I "SendTo" attrib /L +S +H +I "Start Menu" attrib /L +S +H +I "Templates"
If you really only want some of the files, you can always copy just the files you want - by default NTFS partitions should be mounted read-only, so there's no possibility to accidentally change anything.