os:cmd isn't really portable but easy to use and all it takes is a case statement for windows.<div><br></div><div><br></div><div>Sergej<br><br><div class="gmail_quote">On Tue, Mar 13, 2012 at 8:12 AM, Richard O'Keefe <span dir="ltr"><<a href="mailto:ok@cs.otago.ac.nz">ok@cs.otago.ac.nz</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
On 13/03/2012, at 7:09 PM, Zabrane Mickael wrote:<br>
<br>
> Hi guys,<br>
><br>
> I'd like to know if there's a good and portable method to check if a directory is empty (or not)?<br>
> In my case, the directory can contains huge number (more than 150K in average) of files if it is not empty.<br>
><br>
> I've tested the following working calls:<br>
> a. file:list_dir/1<br>
> b. filelib:wildcard/2<br>
<br>
</div>I don't know about filelib, but file:list_dir/1 used to work by going through several<br>
layers and finally sending a command to the 'efile' driver. You might have to extend<br>
the driver.<br>
<br>
For POSIX systems you could always run an outboard command. The Windows 'SUA' kit should<br>
be POSIX enough for this to work.<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br></div>