Try `new \RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS)` here instead.