Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Globbing for Empty Directories?



On Sunday, March 28, 2004, at 02:49 PM, DervishD wrote:

    Hi Aaron :)

 * Aaron Davies <agdavi01@xxxxxxxxxxxxxx> dixit:

Is there a way to get empty directories from a glob pattern? '*(L0)'
finds empty files, but doesn't work for dirs. I'm looking for something
the equivalent of find's -empty argument, since I hate find with a
passion and would love to never use it again.

    There is not, AFAIK. See the mailing list archives, I asked more
or less the same a few months ago. Testing for the number of links
won't work for directories :((

Actually, I'm not sure of that. According to the info page for find, a directory will always have two hard links, itself and it's "." pointer. Adding any subdirectories or files to it seems to increase the number of links it has. So wouldn't *(/l2) find empty directories? Or is this hard-link policy not true on all systems?
--
    __                        __
   /  )                      /  )
  /--/ __.  __  ________    /  / __. , __o  _  _
 /  (_(_/|_/ (_(_) / / <_  /__/_(_/|_\/ <__</_/_)_



Messages sorted by: Reverse Date, Date, Thread, Author