title: Apache Commons VFS: working with FTP
body: <p>I'm trying to use Apache Commons VFS with FTP. On my FTP a have the next structure of files and folders:</p>
  
  <pre><code>/
  /test
  /test/in
  /test/in/file1.txt
  /test/in/file2.txt
  </code></pre>
  
  <p>I need to connect and read all files from folder /test/in (it changes all the time). Code:</p>
  
  <pre><code>        FileSystemManager fsManager = null;
          FileSystem fs = null;
          FileSystemOptions opts = new FileSystemOptions();
          fsManager = VFS.getManager();
  
          FileObject path = fsManager.resolveFile("ftp://user:password@my.ftp.host/test/in/", opts);
  
          fs = path.getFileSystem();
  
          //prints Connection successfully established to /test/in
          System.out.println("Connection successfully established to " + path.getName().getPath());
  </code></pre>
  
  <p>But I couldn't got file list, because it says that /test/in does not exist. A made some tests to check file types:<code>System.out.println(path.getType());</code> with different paths. Results:</p>
  
  <p><a href="ftp://user:password@my.ftp.host/test" rel="nofollow">ftp://user:password@my.ftp.host/test</a> - file</p>
  
  <p><a href="ftp://user:password@my.ftp.host/test/in" rel="nofollow">ftp://user:password@my.ftp.host/test/in</a> - imaginary</p>
  
  <p><a href="ftp://user:password@my.ftp.host/test/in/file1.txt" rel="nofollow">ftp://user:password@my.ftp.host/test/in/file1.txt</a> - file</p>
  
  <p>FileType.IMAGINARY means that file does not exist.
  Any ideas how to work with ftp folders?</p>