Avatar of daisydoos
daisydoos

asked on 

Using the directoryIterator class to read remote directory

Hi,
I am using the class to get a list of file names on my localhost like this:

foreach ( new DirectoryIterator('c:/wamp/www/name/images/etc') as $file)
{
      if (!$file->isDot())
      {
            print $file->getFilename();
      }
}

All fine.

What I want to do is to read the same directory on a remote server - to make sure when I copied the files using FTP they were all done. However, when I try placing the path in the constructor like this:

foreach ( new DirectoryIterator('/home/sites/domainname.com/public_html/images/etc') as $file)
{
      if (!$file->isDot())
      {
            print $file->getFilename();
      }
}

I get errors. Is it not possible to do this?

Any help much appreciated!

Daisy
PHP

Avatar of undefined
Last Comment
daisydoos

8/22/2022 - Mon