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

Re: Globbing for Empty Directories?



On Monday, March 29, 2004, at 06:24 PM, DervishD wrote:

Aaron Davies <agdavi01@xxxxxxxxxxxxxx> dixit:

   I have not tested in many systems, but Linux don't do it, and
I've not found any standard that require files to be links on the
directory. If you find any, please tell me to report the current
behaviour as a bug to Linux kernel developers, but looking at
findutils sources (that being GNU are intended to be very portable),
you can see the following:
I'm on OS X, so it may be a peculiarity of HFS+.

    Do you mean you can know if a dir is empty or not in OS X looking
for the number of st_nlinks it has? I must confess I don't know a
workd about HFS+ O:)

On cursory examination, it would appear so. I haven't done any serious testing (or looked at any docs), but the number of links listed in ls -l for a directory seems to equal the number of files in it plus two.
--
    __                        __
   /  )                      /  )
  /--/ __.  __  ________    /  / __. , __o  _  _
 /  (_(_/|_/ (_(_) / / <_  /__/_(_/|_\/ <__</_/_)_



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