Finding out if a directory is empty ...

Richard Sharpe sharpe at ns.aus.com
Tue Mar 27 04:55:21 GMT 2001


Hi folks,

I need to find out whether or not a directory is empty in order to properly
handle an error case for smbc_unlinkdir ...

I do not want to invoke the whole machinery of cli_list, which additionally
has what I consider a bug, in that I cannot short circuit the listing by
returning false from the list_fn.

In any case, I am thinking of creating a new function, cli_dir_empty or
something like that, which will essentially be copied from cli_list, but
will simply do a FIND_FIRST, and if anything comes back, will return False,
but if nothing comes back (except . and ..) will return True ...

Does anyone know of a better way to do this?

Regards
-------
Richard Sharpe, sharpe at ns.aus.com
Samba (Team member, www.samba.org), Ethereal (Team member, www.ethereal.com)
Contributing author, SAMS Teach Yourself Samba in 24 Hours
Author, Special Edition, Using Samba






More information about the samba-technical mailing list