[erlang-questions] Best way to check if a given directory is empty (or not)?

Wes James comptekki@REDACTED
Tue Mar 13 15:33:35 CET 2012

On Tue, Mar 13, 2012 at 12:09 AM, Zabrane Mickael <zabrane3@REDACTED> wrote:
> Hi guys,
> I'd like to know if there's a good and portable method to check if a directory is empty (or not)?
> In my case, the directory can contains huge number (more than 150K in average) of files if it is not empty.

One possibility:

os:cmd("find folder -d -empty").

returns [] on false

returns ["folder\n"] if true

if you need this on windows, cygwin might work


More information about the erlang-questions mailing list