Given a path name (without preceding and appending "/"),
return the names of all file and directory names contained
in the path location (not recursive).

@param path - name of resource path
@return - list of resource names at that path
518374
public static List<String> getResourcesList(String path) {
    Set<String> resList = new HashSet<>(); // subdirectories can cause duplicate entries
    try {
      // Java doesn't allow simple exploration of resources as directories
      // when the resources are inside a jar file. This searches the contents
      // of the jar to get the list
      URL classUrl = JarHash.class.getResource("/water/H2O.class");
      if (classUrl != null && classUrl.getProtocol().equals("jar")) {
        // extract jarPath from classUrl string
        String jarPath = classUrl.getPath().substring(5, classUrl.getPath().indexOf("!"));
        JarFile jar = new JarFile(URLDecoder.decode(jarPath, "UTF-8"));
        Enumeration<JarEntry> files = jar.entries();
        // look for all entries within the supplied resource path
        while (files.hasMoreElements()) {
          String fName = files.nextElement().getName();
          if (fName.startsWith(path + "/")) {
            String resourceName = fName.substring((path + "/").length());
            int checkSubdir = resourceName.indexOf("/");
            if (checkSubdir >= 0) // subdir, trim to subdir name
              resourceName = resourceName.substring(0, checkSubdir);
            if (resourceName.length() > 0) resList.add(resourceName);
          }
        }
      } else { // not a jar, retrieve resource from file system
        String resourceName;
        BufferedReader resources = new BufferedReader(new InputStreamReader(JarHash.class.getResourceAsStream("/gaid")));
        if (resources != null) {
          while ((resourceName = resources.readLine()) != null)
            if (resourceName.length() > 0)
              resList.add(resourceName);
        }
      }
    }catch(Exception ignore){
      Log.debug("Failed in reading gaid resources.");
    }
    return new ArrayList<>(resList);
  }
1074760
def get_child_folders(path):
        '''  '''
        path = FileHelper.abspath(path)
        return [dirname for dirname in os.listdir(path) if os.path.isdir(os.path.join(path, dirname))]
258135
public Resource getResource(String path) {
        if (hasContext()) {
            return context.getResource(path);
        }
        return getContext().getResource(getContextPath() + '/' + path);
    }
193866
public static List<String> getDirectoryNames(String root, boolean fullPath) {
        List<File> fileList = getDirectoriesByName(root);
        List<String> list = new ArrayList<String>(fileList.size());

        for (File f : fileList) {
            String name = fullPath ? f.getAbsolutePath() : f.getName();
            list.add(name);
        }

        return list;
    }
1270004
def listdir(path='.'):
    
    return [name.rstrip('/') for name, _ in
            get_instance(path).list_objects(path, first_level=True)]
1320104
public static String getFilenameExtension(String path) {
        if (path == null) return null;

        int extIndex = path.lastIndexOf(EXTENSION_SEPARATOR);
        if (extIndex == -1) return null;

        int folderIndex = path.lastIndexOf(FOLDER_SEPARATOR);
        if (folderIndex > extIndex) return null;

        return path.substring(extIndex + 1);
    }
326441
def all_files_in_directory(path):
    
    file_list = []
    for dirname, dirnames, filenames in os.walk(path):
        for filename in filenames:
            file_list.append(os.path.join(dirname, filename))
    return file_list
467536
def listdir(self, path):
        
        return [s for s in self.get_all_data().keys()
                if s.startswith(path)]
558143
static String[] getPathNames(String path) {
    if (path == null || !path.startsWith(Path.SEPARATOR)) {
      return null;
    }
    return StringUtils.split(path, Path.SEPARATOR_CHAR);
  }
228007
private Path[] listPaths(final Path path)
      throws IOException {
    Path[] children = null;
    ArrayList<Path> tmpChildrenPath = new ArrayList<>();
    if (fs.isDirectory(path)) {
      // Get children's path list.
      FileStatus[] chiledrenFileStatus = pathFilter == null ? fs.listStatus(path) : fs.listStatus(path, pathFilter);
      for (FileStatus childFileStatus : chiledrenFileStatus) {
        tmpChildrenPath.add(childFileStatus.getPath());
      }
      children = tmpChildrenPath.toArray(new Path[tmpChildrenPath.size()]);
    }
    if (children == null) {
      children = EMPTY_PATH_ARRAY;
    }
    if (comparator != null && children.length > 1) {
      Arrays.sort(children, comparator);
    }
    return children;
  }
1324084
def DirnamePath(self, path):
    
    if path.endswith(self.PATH_SEPARATOR):
      path = path[:-1]
    if not path:
      return None

    dirname, _, _ = path.rpartition(self.PATH_SEPARATOR)
    return dirname
1108747
public ArrayList<PathImpl> getResources(String pathName)
  {
    ArrayList<PathImpl> list = new ArrayList<PathImpl>();

    String pathname = _pathname;
    // XXX: why was this here?
    if (pathname.startsWith("/"))
      pathname = "." + pathname;

    ArrayList<PathImpl> pathList = ((MergePath) _root)._pathList;
    for (int i = 0; i < pathList.size(); i++) {
      PathImpl path = pathList.get(i);

      path = path.lookup(pathname);

      ArrayList<PathImpl> subResources = path.getResources(pathName);
      for (int j = 0; j < subResources.size(); j++) {
        PathImpl newPath = subResources.get(j);

        if (! list.contains(newPath))
          list.add(newPath);
      }
    }

    return list;
  }
1346676
function getNameFromPath (path) {
  path = _(path).toString();
  let lastSlash = path.substring(0, path.length - 1).lastIndexOf("/");
  if (lastSlash === -1) {
    return normalizeName(path);
  }
  else {
    return normalizeName(path.substring(lastSlash));
  }
}
586639
public static ArrayList<File> getDirectoriesInDirectoryTree(String path) {
		File file = new File(path);
		return getContentsInDirectoryTree(file, "*", false, true);
	}
865800
static List<String> path(String name, @Nullable Path path) {
    if (path != null && !path.toString().isEmpty()) {
      return Arrays.asList("--" + name, path.toAbsolutePath().toString());
    }
    return Collections.emptyList();
  }
527043
def get_filenames_in_lipd(path, name=""):
    
    _filenames = []
    try:
        # in the top level, list all files and skip the "data" directory
        _top = [os.path.join(name, f) for f in os.listdir(path) if f != "data"]
        # in the data directory, list all files
        _dir_data = [os.path.join(name, "data", f) for f in os.listdir(os.path.join(path, "data"))]
        # combine the two lists
        _filenames = _top + _dir_data
    except Exception:
        pass
    return _filenames
138077
public static List<File> getDirectories(File path)
    {
        Check.notNull(path);

        return Optional.ofNullable(path.listFiles())
                       .map(files -> Arrays.asList(files)
                                           .stream()
                                           .filter(File::isDirectory)
                                           .collect(Collectors.toList()))
                       .orElseGet(Collections::emptyList);
    }