Added experimental rewinddir() support.

This should work around issues with inefficient code that performs multiple readdir() loops.