[erlang-questions] Best way to check if a given directory is empty (or not)?
Rapsey
rapsey@REDACTED
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.
Sergej
On Tue, Mar 13, 2012 at 8:12 AM, Richard O'Keefe <ok@REDACTED> 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
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120313/17656040/attachment.htm>
More information about the erlang-questions
mailing list