[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Findutils-patches] Proposed extension to 'find'

From: Dale R. Worley
Subject: [Findutils-patches] Proposed extension to 'find'
Date: Sun, 7 Sep 2014 13:24:21 -0400

For quite a number of years, I've wanted to add an extension to
'find':  The argument to -type can be more than one letter, and the
predicate is true if the i-node is any one of the specified types.

Thus, if I want to list both the regular files and the symbolic links
in a directory tree, I could type

    find . -type fl

True, this could be written "find . -type f -o -type l", but that
seems to me to be excessively awkward, given that the extended syntax
is easy to understand and much simpler to write.

This extension can similarly be added to -xtype.

Looking at the code of 'find', it seems to me that the best way to
implement this is by extending the parser *only*, so that "-type fl"
produces the same list of predicate nodes as "( -type f -o -type l )".
That avoids modifying any of the downstream parts of the code,
including the optimization and searching code.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]