Link to home
Start Free TrialLog in
Avatar of nssasikumar
nssasikumarFlag for India

asked on

Robocopy script to copy only NTFS permission of Top/Root directory

Hi,

Need Robocopy script to copy only NTFS permission of Top/Root directory, should exclude all Sub directories and Files under Top/Root directory.

The following script doesn't work as expected:

ROBOCOPY C:\RTest\source Y:\RTest\source /ZB /LEV:0 /COPY:SOU /XF *.* /R:10 /W:5 /log+:C:\CopyOnlyNTFSRootDir.txt
Avatar of Alex
Alex
Flag of United Kingdom of Great Britain and Northern Ireland image

You need your /sec switch in there to copy the security structure I think
If Robocopy doesn't work you could take a look at icacls? http://technet.microsoft.com/en-us/library/cc753525.aspx

You can backup the NTFS rights from one directory and restore them on the new directory...
The command as you have it now (ROBOCOPY C:\RTest\source Y:\RTest\source /ZB /LEV:0 /COPY:SOU /XF *.* /R:10 /W:5 /log+:C:\CopyOnlyNTFSRootDir.txt ) will not copy any files or subdirectories. If you want to copy the NTFS permissions of the source folder to the destination folder it must be set to copy something. Will it work if we let it copy the files in the source and then delete them afterwards?
ASKER CERTIFIED SOLUTION
Avatar of nssasikumar
nssasikumar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Good thinking
Avatar of nssasikumar

ASKER

The Script Copies only NTFS Permission for Specified folder e.g Source in our Example. Does not copy any Data, Also the Permission for Sub directories/Files are not copied.