Lists directories located under a given file.
@param root a file
@return a non-null list of directories, sorted alphabetically by file names
497019
public static List<File> listDirectories( File root ) {

		List<File> result = new ArrayList<> ();
		File[] files = root.listFiles( new DirectoryFileFilter());
		if( files != null )
			result.addAll( Arrays.asList( files ));

		Collections.sort( result, new FileNameComparator());
		return result;
	}
816005
private Collection<File> doListAllFiles(File rootDir,
                                            boolean includeDirectories) {
        Collection<File> result = new Stack<File>();
        File[] files = rootDir.listFiles();
        for (File f : files) {
            if (f.isDirectory()) {
                if (includeDirectories) {
                    result.add(f);
                }
                result.addAll(doListAllFiles(f, includeDirectories));
            } else if (f.isFile()) {
                result.add(f);
            }
        }
        return result;
    }
176143
FileStatus[] getListing(String src) {
    String srcs = normalizePath(src);
    byte[][] components = INodeDirectory.getPathComponents(srcs);
    readLock();
    try {
      INode targetNode = rootDir.getNode(components);
      if (targetNode == null)
        return null;
      if (!targetNode.isDirectory()) {
        return new FileStatus[]{createFileStatus(
        		src, targetNode)};
      }
      List<INode> contents = ((INodeDirectory)targetNode).getChildren();
      if(! srcs.endsWith(Path.SEPARATOR))
    	  srcs += Path.SEPARATOR;
      FileStatus listing[] = new FileStatus[contents.size()];
      int i = 0;
      for (INode cur : contents) {
        listing[i] = createFileStatus(srcs+cur.getLocalName(), cur);
        i++;
      }
      return listing;
    } finally {
      readUnlock();
    }
  }
556797
public static List<File> getFiles(File directory)
    {
        Check.notNull(directory);

        if (directory.isDirectory())
        {
            final File[] files = directory.listFiles();
            if (files != null)
            {
                return Arrays.asList(files);
            }
        }
        throw new LionEngineException(ERROR_DIRECTORY + directory.getPath());
    }
1050608
public void setRoots(java.util.Collection<Root> roots) {
        if (roots == null) {
            this.roots = null;
            return;
        }

        this.roots = new java.util.ArrayList<Root>(roots);
    }
715172
public static String[] getRootFolders() {
        Configuration config = ConfigUtils.getCurrentConfig();
        if (config != null) {
            return config.getStringArray(ROOT_FOLDERS_CONFIG_KEY);
        } else {
            return null;
        }
    }
60001
private static List<String> getResourcesFromDirectory(final File directory, final Pattern searchPattern) {
        final List<String> resources = new ArrayList<>();

        // Filter only properties files
        final File[] fileList = directory.listFiles();

        if (fileList != null && fileList.length > 0) {
            // Iterate over each relevant file
            for (final File file : fileList) {
                // If the file is a directory process a recursive call to explorer the tree
                if (file.isDirectory()) {
                    resources.addAll(getResourcesFromDirectory(file, searchPattern));
                } else {
                    try {
                        checkResource(resources, searchPattern, file.getCanonicalPath());
                    } catch (final IOException e) {
                        LOGGER.log(BAD_CANONICAL_PATH, e);
                    }
                }
            }
        }
        return resources;
    }
471083
private ArrayList<String> getFiles(String dir, String subDir) {
    ArrayList<String> files = new ArrayList<>();
    String fullDir = subDir == null ? dir : dir + File.separator + subDir;
    File[] listOfFiles = (new File(fullDir)).listFiles();
    if (listOfFiles != null) {
      for (File file : listOfFiles) {
        String fullName = subDir == null ? file.getName() : subDir + File.separator + file.getName();
        if (file.isFile()) {
          files.add(fullName);
        } else if (file.isDirectory()) {
          files.addAll(getFiles(dir, fullName));
        }
      }
    }
    return files;
  }
820158
public static File[] listFile(File director) {
        String basePath = director.getAbsolutePath() + ValueConsts.SEPARATOR;
        String[] filePath = director.list();
        File[] files = null;
        if (Checker.isNotNull(filePath)) {
            files = new File[filePath.length];
            int i = 0;
            for (String s : filePath) {
                files[i++] = new File(basePath + s);
            }
        }
        return files;
    }
1094769
static public void scanRoot(File root,
                                Set<String> suffixes,
                                List<String> excludes, List<String> includes,
                                List<String> excludeFiles, List<String> includeFiles,
                                Map<String,Source> foundFiles,
                                Map<String,Module> foundModules,
                                Module currentModule,
                                boolean permitSourcesWithoutPackage,
                                boolean inGensrc,
                                boolean inLinksrc)
        throws ProblemException {

        if (root == null) return;
        int root_prefix = root.getPath().length()+1;
        // This is the root source directory, it must not contain any Java sources files
        // because we do not allow Java source files without a package.
        // (Unless of course --permit-sources-without-package has been specified.)
        // It might contain other source files however, (for -tr and -copy) these will
        // always be included, since no package pattern can match the root directory.
        currentModule = addFilesInDir(root, root_prefix, root, suffixes, permitSourcesWithoutPackage,
                                       excludeFiles, includeFiles, false,
                                       foundFiles, foundModules, currentModule,
                                       inGensrc, inLinksrc);

        File[] dirfiles = root.listFiles();
        for (File d : dirfiles) {
            if (d.isDirectory()) {
                // Descend into the directory structure.
                scanDirectory(d, root_prefix, root, suffixes,
                              excludes, includes, excludeFiles, includeFiles,
                              false, foundFiles, foundModules, currentModule, inGensrc, inLinksrc);
            }
        }
    }
1156379
def find_files(self, root):
        

        def is_ignored(path, ignore_patterns):
            """
            Check if the given path should be ignored or not.
            """
            filename = os.path.basename(path)
            ignore = lambda pattern: fnmatch.fnmatchcase(filename, pattern)
            return any(ignore(pattern) for pattern in ignore_patterns)

        dir_suffix = '%s*' % os.sep
        normalized_patterns = [
            p[:-len(dir_suffix)] if p.endswith(dir_suffix) else p
            for p in self.ignore_patterns
        ]

        all_files = []
        walker = os.walk(root, topdown=True, followlinks=self.follow_symlinks)
        for dir_path, dir_names, file_names in walker:
            for dir_name in dir_names[:]:
                path = os.path.normpath(os.path.join(dir_path, dir_name))
                if is_ignored(path, normalized_patterns):
                    dir_names.remove(dir_name)
                    if self.verbose:
                        print_out("Ignoring directory '{:}'".format(dir_name))
            for file_name in file_names:
                path = os.path.normpath(os.path.join(dir_path, file_name))
                if is_ignored(path, self.ignore_patterns):
                    if self.verbose:
                        print_out("Ignoring file '{:}' in '{:}'".format(
                                  file_name, dir_path))
                else:
                    all_files.append((dir_path, file_name))
        return sorted(all_files)
1002752
public static function listDirsRecusrive($root)
    {
        $dirs = [];
        foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($root, FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST) as $path) {
            if ($path->isDir()) {
                $dirs[] = $path->getPathname();
            }
        }
        return $dirs;
    }
1298403
private List<File> listFiles(File file, List<File> files) {
        File[] children = file.listFiles();
        
        if (children != null) {
            for (File child : children) {
                files.add(child);
                listFiles(child, files);
            }
        }
        
        return files;
    }
478577
private void listFiles(File dir, List<File> results) {
        File[] found = dir.listFiles();
        if ( found != null ) {
            for ( File f : found ) {
                if (f.isDirectory()) {
                	//do nothing
                } else {
                    results.add(f);
                }
            }
        }
    }
286610
public static Path pathForFileInRoot(
            final File rootDir,
            final File file
    )
    {
        String filePath = file.getAbsolutePath();
        String rootPath = rootDir.getAbsolutePath();
        if (!filePath.startsWith(rootPath)) {
            throw new IllegalArgumentException("not a file in the root directory: " + file);
        }
        return pathForRelativeFilepath(filePath.substring(rootPath.length()));
    }
347204
private List<String> existingRootFiles() {
        List<String> filesFound = new ArrayList<>();
        for (String path : SU_PATHS) {
            if (new File(path).exists()) {
                filesFound.add(path);
            }
        }
        return filesFound;
    }
289725
function listFiles(root, options) {
    options = _.defaults(options || {}, {
        ignoreFiles: [],
        ignoreRules: []
    });

    var d = Q.defer();

    // Our list of files
    var files = [];

    var ig = Ignore({
        path: root,
        ignoreFiles: options.ignoreFiles
    });

    // Add extra rules to ignore common folders
    ig.addIgnoreRules(options.ignoreRules, '__custom_stuff');

    // Push each file to our list
    ig.on('child', function (c) {
        files.push(
            c.path.substr(c.root.path.length + 1) + (c.props.Directory === true ? '/' : '')
        );
    });

    ig.on('end', function() {
        // Normalize paths on Windows
        if(process.platform === 'win32') {
            return d.resolve(files.map(function(file) {
                return file.replace(/\\/g, '/');
            }));
        }

        // Simply return paths otherwise
        return d.resolve(files);
    });

    ig.on('error', d.reject);

    return d.promise;
}