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


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
Who is Participating?
nssasikumarConnect With a Mentor Author Commented:
The Following script worked for me:

ROBOCOPY C:\RTest\source Y:\RTest\source /ZB /E /LEV:0 /COPY:SOU /XF *.* /XD *.* /R:10 /W:5 /log+:C:\CopyOnlyNTFSRootDir.txt
Alex Green3rd Line Server SupportCommented:
You need your /sec switch in there to copy the security structure I think
Zephyr ICTCloud ArchitectCommented:
If Robocopy doesn't work you could take a look at icacls?

You can backup the NTFS rights from one directory and restore them on the new directory...
WEBINAR: GDPR Implemented - Tips & Lessons Learned

Join the WatchGuard team on Thursday, March 29th as we recount some valuable lessons learned in weighing the needs of a business against the new regulatory environment, look ahead at the two months left before implementation, and help you understand the steps you can take today!

Lionel MMSmall Business IT ConsultantCommented:
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?
Lionel MMSmall Business IT ConsultantCommented:
Good thinking
nssasikumarAuthor Commented:
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.