<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Yep. Any other advices/hints?<div><div><br class="webkit-block-placeholder"></div><div><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div>Regards,</div><div>Zabrane</div><div><br></div></span></div><div><div>On Mar 13, 2012, at 9:03 AM, Steve Strong wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div bgcolor="#FFFFFF"><div>Yeah, if there are other processes (erlang or os) then that would be a problem :) - obviously easy to recreate the directory if it did get deleted but you would have that time when it wasn't there.<br><br>Sent from my iPhone</div><div><br>On 13 Mar 2012, at 08:49, Zabrane Mickael <<a href="mailto:zabrane3@gmail.com">zabrane3@gmail.com</a>> wrote:<br><br></div><div></div><blockquote type="cite"><div><div>I already tried the file:del_dir/1 trick.</div><div><br></div><div>The only downside is when this directory is really empty ... then it will be deleted.</div><div>My app will not work anymore as the existence of the directory is mandatory.</div><div><br></div><div><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div>Regards,</div><div>Zabrane</div><div><br></div></span></div><div><br class="webkit-block-placeholder"></div><div><div>On Mar 13, 2012, at 8:41 AM, Steve Strong wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
                <div>
                    Not a good solution if other apps are using the directory, but if it's just your app you could call file:del_dir() - if it's empty, it will return ok if not you'll get an {error,eexist} error.  No idea on the performance characteristics, but suspect it's pretty good...</div>
                <div><div><br></div><div>-- </div>Steve Strong<div>@srstrong</div><div><br>Sent with <a href="http://www.sparrowmailapp.com/?sig">Sparrow</a></div><div><br></div></div><p style="color: #A0A0A8;">On Tuesday, 13 March 2012 at 07:09, Zabrane Mickael wrote:</p>
                <blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
                    <span><div><div><div>Hi guys,</div><div><br></div><div>I'd like to know if there's a good and portable method to check if a directory is empty (or not)?</div><div>In my case, the directory can contains huge number (more than 150K in average) of files if it is not empty.</div><div><br></div><div>I've tested the following working calls:</div><div>a. <a href="file://list">file:list</a>_dir/1</div><div>b. filelib:wildcard/2</div><div><br></div><div>The problem with them is they both return a list of filenames.</div><div>I'd like to avoid getting this list back to be able to check if it's empty or not.</div><div><br></div><div>Advices please?</div><div><br></div><div>Regards</div><div>Zabrane</div><div>_______________________________________________</div><div>erlang-questions mailing list</div><div><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a></div><div><a href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a></div></div></div></span>
                 
                 
                 
                 
                </blockquote>
                 
                <div><br></div></blockquote></div><div apple-content-edited="true">
</div>
<br></div></blockquote></div></blockquote></div><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div><br></div></span></div></div></body></html>