Exclude System entries with "ls" or "find"

Eliot Moss moss@cs.umass.edu
Tue Dec 18 15:51:00 GMT 2018


On 12/18/2018 3:13 AM, Corinna Vinschen wrote:

>> as can be seen, Command Prompt has a way to exclude System items. Does Cygwin
>> have some way to do this, perhaps with "ls" or "find"?
> 
> You're asking POSIX tools to recognize DOS attributes...

True; expanding on Corinna's response slightly.  I used "touch" to create a file.
I looked at its Windows access control information with icacls.  I then used
Windows attrib to set the SYS attribute and looked at the ACL again with icacls.
There was no difference.  The reason this is relevant is that the information
printed by (e.g., ls -l) is based on a mapping Cygwin provides from Windows
ACLs to POSIX permissions and ACLs.  (That mapping is *not* one-to-one, because
the models are substantially different, but Cygwin does what it can, and its
mapping has been refined over time to something that seems most useful, but
that can sometimes have its pitfalls if you don't use it carefully.)

The reason I mention the above was to demonstrate something that I already
knew: the Windows attribute bits are orthogonal to (distinct from) permissions /
access related information.  While access information has an analog in POSIX,
the attribute bits do not.  So Cygwin tools don't look at / display them, while
that *do* map access control, date/time stamps, etc., as well as they can.

However, you can run DOS attrib from Cygwin, just like any Windows program,
and parse its output.  So it would be possible to use a combination of Windows
and Cygwin tools to do what you're seeking, though not necessarily with high
efficiency, etc.

Regards - Eliot Moss

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list