It is crucial to note that rewinddir() does not simply start over at the beginning of the SAME directory list. Instead, this function first re-reads the directory - thus any file that were deleted (or inserted) since the original opendir() will be reflected after "rewinding".
In that respect, rewinddir() is equivalent to a closedir(), opendir() sequence, but without obtaining a new handle.