1 Reply Latest reply: Sep 7, 2011 10:47 AM by 886787 RSS

    How to access ShellFolder using a path


      I would like to have the ShellFolder of a given path to browse its content.
                           FileSystemView systemView = FileSystemView.getFileSystemView();
                File homeDirectory = systemView.getHomeDirectory();
                File[] files = systemView.getFiles(homeDirectory,false);
                File home2=new File(homeDirectory.getAbsolutePath());
                File[] files1 = systemView.getFiles(home2, false);
                File[] files2 = home2.listFiles();
                File[] files3 = homeDirectory.listFiles();
      When the home is obtained using FileSystemView, everything is fine (I obtain what I expect) in the list appear Computer, Network, ... but when I attempt to recreate the file using a path I obtain a subset of the previous result without Computer, Network, ... It just contains the list of "physical" files on the dirve, all "system" files are not present.

      Is there a solution to obtain an instance of the right File object pointing to the homeDirectory or ComputerDirectory or Network Directory giving <u> a path </u> (I don't know which one, this may include clsid) ?

        • 1. Re: How to access ShellFolder using a path
          Here is a not perfect solution:
          private File createFolderByPath(String path) {
                    File file = getLocalRepository();
                    String[] strings = path.split("/");
                    for (int i = 0; i < strings.length; i++) {
                         String string = strings;
                         file = systemView.getChild(file, string);
                    return file;
          If someone has a better idea...