code: private void importResources(File folder, String importPath) throws Exception {
  
          String[] diskFiles = folder.list();
          File currentFile;
  
          for (int i = 0; i < diskFiles.length; i++) {
              currentFile = new File(folder, diskFiles[i]);
  
              if (currentFile.isDirectory()) {
                  // create directory in cms
                  m_importedResources.add(
                      m_cms.createResource(importPath + currentFile.getName(), CmsResourceTypeFolder.RESOURCE_TYPE_ID));
                  importResources(currentFile, importPath + currentFile.getName() + "/");
              } else {
                  // import file into cms
                  int type = OpenCms.getResourceManager().getDefaultTypeForName(currentFile.getName()).getTypeId();
                  byte[] content = CmsFileUtil.readFile(currentFile);
                  // create the file
                  try {
                      m_importedResources.add(
                          m_cms.createResource(importPath + currentFile.getName(), type, content, null));
                  } catch (CmsSecurityException e) {
                      // in case of not enough permissions, try to create a plain text file
                      int plainId = OpenCms.getResourceManager().getResourceType(
                          CmsResourceTypePlain.getStaticTypeName()).getTypeId();
                      m_importedResources.add(
                          m_cms.createResource(importPath + currentFile.getName(), plainId, content, null));
                  }
                  content = null;
              }
          }
      }
docs: Imports the resources from the folder in the real file system to the OpenCms VFS.<p>
  
  @param folder the folder to import from
  @param importPath the OpenCms VFS import path to import to
  @throws Exception if something goes wrong during file IO