[Linux-disciples] find(1) to find only leaf nodes?

Stephen R Laniel steve at stevereads.com
Thu Feb 12 15:56:24 EST 2009


Of course: -empty. Thanks, Dylan!


--  
Stephen R. Laniel
steve at stevereads.com
Cell: +(617) 308-5571
http://stevereads.com/
PGP key: http://stevereads.com/slaniel.key

On Feb 12, 2009, at 3:44 PM, Dylan Thurston <dpt at math.columbia.edu>  
wrote:

> On Thu, Feb 12, 2009 at 11:08:17AM -0500, Stephen R Laniel wrote:
>> I was hoping there would be a -leaf
>> argument to find(1), which would return
>> only those elements of the filesystem
>> tree that have no children. That would
>> mean either
>>
>> - non-directories ("-not -type d"), or
>> - directories with no children
>
> dpt at amaryllis:/tmp$ find test -not -type d -or \( -type d -and - 
> empty \)
> test/a
> test/b/c
> test/b/d
> test/b/e
> dpt at amaryllis:/tmp$ ls -R test
> test:
> a  b
>
> test/a:
>
> test/b:
> c  d  e
>
> test/b/d:
> _______________________________________________
> Linux-disciples mailing list
> Linux-disciples at lists.bostoncoop.net
> http://lists.bostoncoop.net/mailman/listinfo/linux-disciples
>


More information about the Linux-disciples mailing list