[erlang-questions] Best way to check if a given directory is empty (or not)?
Tue Mar 13 08:37:01 CET 2012
os:cmd isn't really portable but easy to use and all it takes is a case
statement for windows.
On Tue, Mar 13, 2012 at 8:12 AM, Richard O'Keefe <> wrote:
> On 13/03/2012, at 7:09 PM, Zabrane Mickael 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.
> > I've tested the following working calls:
> > a. file:list_dir/1
> > b. filelib:wildcard/2
> I don't know about filelib, but file:list_dir/1 used to work by going
> through several
> layers and finally sending a command to the 'efile' driver. You might
> have to extend
> the driver.
> For POSIX systems you could always run an outboard command. The Windows
> 'SUA' kit should
> be POSIX enough for this to work.
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions