2

I am looking for a utility to which I can specify a directory to be recursively scanned. The utility should generate a batch file consisting of calls to icacls to reproduce the file and directory permissions under the specified path.

The icacls /save command is not suitable for this task particularly because it duplicates inherited permissions unnecessarily and it outputs SIDs instead of friendly account names.

  • So what do you want to do about inherited permissions then? Should permissions from parents be discarded? Does this also need to handle ownership in any manner? – jscott Mar 6 '13 at 0:57
  • @jscott, it should emit (OI)(CI) at the directory where the inherited entires are actually defined and the system will take care of the propagation. – Jason Kresowaty Mar 6 '13 at 2:10
  • So then it walks "up" from the directory provided. But surely you mean it should emit (OI)(CI) only at the directories which inherit "This folder, subfolders, and files", the other inherit modes (OI)(CI)(IO), (CI)(IO), and (OI)(IO) should be handled respectively. – jscott Mar 6 '13 at 2:48
  • Essentially, it should generate the minimum number of icacls calls to exactly reapply the original permissions. In the case that all entries on a specific directory or file are inherited entries, it should generate no icacls call for that directory or file. – Jason Kresowaty Mar 6 '13 at 3:01
0

If I understand you correctly, you want to apply the perms of a directory to it's children? you can use powershell scripts for this. You can recursively scan directorys, and for each directory you can act on it, for example

Get-ChildItem C:\users\me\desktop -Recurse -Attributes Directory | foreach {Get-Acl $_.FullName | Format-List | Tee-Object C:\acls.list} 

will recurse all directories in my desktop and output the permissions to the console and also to a file called C:\acls.list. You can also change ownership info, apply perms recursively, and pretty much whatever icalcs would do using get-acl and set-acl

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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