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

Stephen R Laniel steve at stevereads.com
Thu Feb 12 11:08:17 EST 2009


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

If I knew how to say the second bullet
using find(1) predicates, I could just
"-or" them together.

(I hold open the possibility that the
first bullet may be more tricky than
just "-not -type d", because of funky
special files like sockets or whatnot,
but I think what I have there will get
99.99% of the interesting cases.)

So: any idea how to make that second
bullet happen?

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


More information about the Linux-disciples mailing list