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

Richard O'Keefe ok@REDACTED
Tue Mar 13 22:55:24 CET 2012


On 14/03/2012, at 3:33 AM, Wes James wrote:

> 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").

The OP asked for a >portable< method.  -empty is not portable.




More information about the erlang-questions mailing list