|
|
Re: Script to list all filesystem objects with ACLs
The various control characters + newlines in the script make it quite sensitive (easily broken) and a bit difficult to reproduce. I've created an awk variant that pretty much does the same, but it's a lot more resistant to the usual copy&paste errors. Here's the script (put it into something like "find_acls.sh"):
You can execute it as it is or supply a path as parameter if you want to list ACLs only in a directory. On my MacBook Pro it ran for 45-48 minutes. The "find + ls" takes the most of this, the awk script runs only in 7 seconds or so (I mean if you separate the two and do not use a pipe). Btw. here're two nice primers on ACLS (in case you wonder what an ACL is and how to use, enable or disable it, etc.):
Re: Script to list all filesystem objects with ACLs
There's a case where both the original script and my awk variant "fail": if a file or directory name contains a newline and after that a space, a number and a colon. You can create such a file with a command like this:
However I consider this a minor flaw and it'd be quite inefficient if one would try to write a script that considers even this special case. You'd have to create a complete file listing with "find" (using the "-print0" option to have the zero byte as a separator) and query the ACLs one by one for each file and process the output accordingly.
Re: Script to list all filesystem objects with ACLs
I haven't been a big awk fan over the years, but awk may be a better choice in this case, since it can easily access the previous line.
Re: Script to list all filesystem objects with ACLs
You're right: my previous script did only filter the output of find+ls and did not produce a CSV like structure. Just for the sake of practise, I've created a pure sed variant that really creates CSV output:
It seems that the sed in Darwin is not fully following the description of it's manpages. :-( Unfortunately this script turned out to be really slow. It processed my 130MB file listing in several minutes (4-5min). I've created an Awk script that creates a CSV output as well:
This one processed the 130MB file listing in 20 seconds. The output is a comma separated file where multiple ACLs are kept in a single field (spreadsheet cell).
|
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.09 seconds |
|