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

Michael Turner <>
Wed Mar 14 10:06:55 CET 2012


> There is also filelib:file_size

Which also always returns zero on Winblows, regardless of directory content.

-michael turner

On Wed, Mar 14, 2012 at 12:57 AM, Wes James <> wrote:
> There is also filelib:file_size
>
> Another thing to look at.  Can you keep track of when the folder is
> first created:
>
>  #file_info.atime (keep somwhere like ets table)
>
> then later read #file_info.atime and compare?
>
> The problem here is that when a file file is written or the folder is
> just plane read (I did ls of folder and the atime changed) the atime
> changes.
>
> Will the folder ever be accessed other than to have a file be written
> to it, if so, this may work.
>
> -wes
>
> On Tue, Mar 13, 2012 at 9:34 AM, Zabrane Mickael <> wrote:
>>
>> On Mar 13, 2012, at 4:33 PM, Wes James wrote:
>>
>>> Per Bengt's experience.  What happens if you add a file?  Does the size change?
>>
>> Nothing change when I added a file.
>>
>> Regards,
>> Zabrane
>>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list