Ugly bug in Robocopy - ignoring security on file level
I really like RoboCopy (robust file copy) utility from Microsoft - if you dont know this tool (I would be surprised), it adds tons of features to standart Copy command - and probably the most useful is /MIR (mirror) that creates mirror of source folder.
One of main benefits of mirror is that it is really fast and you can always use it to easily replicate different folders. Problem is that Mir is ignoring NTFS security.
I know, I know, you can use /SEC - but you can still run into issues. Problem is that when using MIR switch, robocopy ignores ACL - so if you use RoboCopy Source Target /MIR /SEC, security settings are transfered - BUT if they are changed on source or target, these ACLs are not mirrored. This is only problem of files, not folders(!).
This can be really annoying, currently you can use following as workaround:
RoboCopy /Mir <Source> <Target>
RoboCopy /E /Copy:S /IS /IT <Source> <Target>
Second line will copy files again, but now with security...
Hope so Microsoft will fix this in next (if any) version of RoboCopy :(
UPDATE: So, there are two newer versions than XP010 - version XP026 (that is part of Robocopy GUI) and XP027 (this is part of Windows Vista). Problem is that XP027 is not working under Windows XP\2003 (not tested, if someone have Vista, please test and let me know). Version XP026 is part of (not really useful - my opinion) Robocopy GUI. You can either install it and get Robocopy from System32... You can then use syntax RoboCopy <Source> <Target> /SecFix /xo /xn /xc /e /COPY:S
This wont copy files, it will just reapply security settings.
UPDATE2: Due to fact that it is not that easy to get Robocopy XP026 and you must install (quite ugly and useless) GUI to get it, I uploaded it to Microsoft SkyDrive: