title: Symfony-Finder cant open dir
body: <p>I try to read the dir and wanna get the last files from the current date.</p>
  
  <p>When I put the url in the browser I got a result of all the files, which are in the ftp-directory.</p>
  
  <p>So I have the proof, that the ftp-connectionparameter still works.</p>
  
  <p><a href="https://i.stack.imgur.com/KpobO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KpobO.png" alt="enter image description here"></a></p>
  
  <p>When I try to start the following function, then I get the error</p>
  
  <blockquote>
    <p>RecursiveDirectoryIterator::__construct(<a href="ftp://...@example.com:4242" rel="nofollow noreferrer">ftp://...@example.com:4242</a>): failed to open dir: operation failed</p>
  </blockquote>
  
  <p>Here is the Exception from symfony:</p>
  
  <p><a href="https://i.stack.imgur.com/18pEf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/18pEf.png" alt="enter image description here"></a></p>
  
  <pre><code>/**
   * @Route("/download", name="getfile")
   */
  public function getFileWithFtp()
  {
  
      $host = "example.com";
      $username = "username";
      $userpass = "userpass";
      $port = 4242;
  
  
      $url = 'ftp://' . $username . ':' . $userpass . '@' . $host . ':' . $port .'/';
      $datum = date('Y-m-d');
  
      $finder = new Finder();
      $iterator = $finder
          -&gt;files()
          -&gt;in($url)
          -&gt;name('*BEHWN.TXT')
          -&gt;date($datum);
  
      $anzahl = count($iterator);
  
      return $this-&gt;render('ftp/index.html.twig', [
          'controller_name' =&gt; 'FtpController',
          'url' =&gt; $url,
          'anzahl' =&gt; $anzahl
      ]);
  }
  </code></pre>
  
  <p>WHen i open the url with the file with file_gets_content($url."filename.txt"), then i get the content without error.</p>
  
  <p>Only it seems that I dont use the Finder from Symfony not correct.</p>
  
  <p>My current Symfony is 4.1.4 and I had cleared the caches and also i deleted the cache-files manually.</p>
  
  <p>Thanks for every tipp</p>
  
  <p>Here is the link to the symfony-finder-component:
  <a href="https://symfony.com/doc/current/components/finder.html" rel="nofollow noreferrer">https://symfony.com/doc/current/components/finder.html</a></p>
  
  <p>As the Finder uses PHP iterators, you can pass any URL with a supported protocol:</p>
  
  <p>Here is the part of the FTP code from the documentation:</p>
  
  <pre><code>// always add a trailing slash when looking for in the FTP root dir
  $finder-&gt;in('ftp://example.com/');
  
  // you can also look for in a FTP directory
  $finder-&gt;in('ftp://example.com/pub/');
  </code></pre>