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

Richard O'Keefe ok@REDACTED
Tue Mar 13 22:57:17 CET 2012


On 14/03/2012, at 4:18 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.
> 
> Another thing to look at.  When I create an empty folder on my mac (I
> tested this with 2 folders and some subfolders), they seem to always
> have a size of 68 bytes when first created (empty).

The OP asked for a >portable< method.
f% mkdir fred
f% ls -ld fred
drwxr-xr-x   2 me       cstaff       512 Mar 14 10:56 fred
                                     ^^^





More information about the erlang-questions mailing list