On 26/02/2007, at 10:00 AM, Harrie Westphal wrote:
> The "Count DownTo 1" idiom is used not because of speed but because
> this is a routine to delete files. If you go the other direction,
> starting with 1 and going to Count, you will find that when you are
> done you have deleted only half of the files.

not if you refer to child(0) each time through the loop.

Sorry, I didn't post code to make my suggestion clearer.

AFAIK I know, the safest way is a loop which takes nothing for  
granted, including the possibility of files being added or deleted  
during the loop by outside forces and that you might not be able to  
delete a file yourself

naively:
while dir.Count > 0
   delete dir.child(0)
wend

Working out how to avoid trying to delete files you couldn't delete  
earlier is left as an exercise for the reader because dinner's ready.

Andy
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to