Finding out if a directory is empty ...

Kenichi Okuyama okuyamak at dd.iij4u.or.jp
Tue Mar 27 04:52:48 GMT 2001


Dear Sharpe,

>>>>> "RS" == Richard Sharpe <sharpe at ns.aus.com> writes:
RS> I need to find out whether or not a directory is empty in order to properly
RS> handle an error case for smbc_unlinkdir ...

Why don't you simply call rmdir() system call?

If directory is empty, you'll succeed.
If it's not, you'll fail.

If you fail, look at errno, they'll give you the reason why.
# Though you might need errno mapping table for each OS,
# this is lot faster and simpler way than any other way.
----
Kenichi Okuyama @Tokyo Research Lab. IBM-Japan. Co.




More information about the samba-technical mailing list