I\'m using laravel/homestead vagrant box.
When I try to use DirectoryIterator
for synced folder it returns only the "dot" entries (..
,.
I had the same issue with vagrant. I debugged a little and found out the issue is the in the file type of the synced folder and not with the DirectoryIterator
Vagrantfile - folder sync config issue
config.vm.synced_folder "/var/www/virtual/machine/folder", "/var/www/host/machine/folder"
In the above configuration I did not specify any file type for the sync folder. because of that, Vagrant automatically choose the best synced folder option for my environment
I have changed the sync folder file type to "nfs" which solved the issue
Vagrantfile - solution
config.vm.synced_folder "/var/www/virtual/machine/folder", "/var/www/host/machine/folder", type: "nfs"
Before using synced folders backed by NFS, the host machine must have nfsd installed, the NFS server daemon. This comes pre-installed on Mac OS X, and is typically a simple package install on Linux.