Seems like when I specify a directory and the recursive flag when constructing a new DirectoryIterator, it takes a looong time if the directory has many subdirectories.
This is rather bad, because if this is done in some Thread, I have no way to cancel this action (when the user presses “Cancel”, and the DirectoryIterator constructor is just constructing, the user will have to wait up to minutes until the Cancel action succeeds).
Is there no way to do this better? I mean, the DirectoryIterator should at least have a flag to stop it doing the scan - in my opinion, every action that can potentially take more than 0.25 seconds should be abortable. This is clearly not the case here.