Searches recursively for all source files in a directory.
427601
def __find_source_files(self):
        
        for dir_path, _, files in os.walk(self._source_directory):
            for name in files:
                if name.lower().endswith(self._source_file_extension):
                    basename = os.path.splitext(os.path.basename(name))[0]
                    relative_path = os.path.relpath(os.path.join(dir_path, name))

                    if basename in self._source_file_names:
                        self._io.error("Files '{0}' and '{1}' have the same basename.".
                                       format(self._source_file_names[basename], relative_path))
                        self.error_file_names.add(relative_path)
                    else:
                        self._source_file_names[basename] = relative_path
1083523
def find_subdirectories(basepath):
    '''
    
    '''
    directories = []
    for root, dirnames, filenames in os.walk(basepath):
        new_directories = [d for d in dirnames if d not in directories]
        directories = directories + new_directories
    return directories
828640
function filterFiles(files, recursive) {
    var fileOrDir = function fileOrDir(lstat) {
        return lstat.isFile() || lstat.isDirectory();
    };
    return files.filter(function (_ref) {
        var lstat = _ref.lstat;

        return recursive ? fileOrDir(lstat) : lstat.isFile();
    });
}
1145395
function (search) {
            var result = false;

            files.forEach(function (elem) {
                if (elem.path === search) {
                    result = true;
                }
            });
            
            return result;
        }
1092135
public static List<File> findFilesRecursive(final File dir, final String filenameToSearch)
	{
		final List<File> foundedFileList = new ArrayList<>();
		final String regex = RegExExtensions.replaceWildcardsWithRE(filenameToSearch);
		// Get all files
		final File[] children = dir.getAbsoluteFile().listFiles();
		if (children == null || children.length < 1)
		{
			return foundedFileList;
		}
		for (final File element : children)
		{
			// if the entry is a directory
			if (element.isDirectory())
			{ // then
				// find recursively in the directory and put it in a List.
				final List<File> foundedFiles = findFilesRecursive(element, filenameToSearch);
				// Put the founded files in the main List.
				foundedFileList.addAll(foundedFiles);
			}
			else
			{
				// entry is a file
				final String filename = element.getName();
				if (filename.matches(regex))
				{
					foundedFileList.add(element.getAbsoluteFile());
				}
			}
		}
		return foundedFileList;
	}
401807
private static Collection<Path> findFiles(FileSystem fs, final String contains) throws IOException {
        final ArrayList<Path> rv = new ArrayList<>();
        Iterator<Path> dirs = fs.getRootDirectories().iterator();
        Files.walkFileTree(dirs.next(), new SimpleFileVisitor<Path>() {
            @Override
            public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
                if (file.toString().contains(contains)) {
                    rv.add(file);
                }
                return FileVisitResult.CONTINUE;
            }
        });
        if (dirs.hasNext()) {
            // There is more than one root directory.
            throw new IOException("FileSystem had more than one root directory: " + fs);
        }
        return rv;
    }
809252
protected function _searchFiles() {
		foreach ($this->_paths as $path) {
			$Folder = new Folder($path);
			$files = $Folder->findRecursive('.*\.(' . implode('|', $this->settings['files']) . ')', true);
			foreach ($files as $file) {
				if (strpos($file, DS . 'Vendor' . DS) !== false) {
					continue;
				}
				$this->_files[] = $file;
			}
		}
	}
434534
function find(source, fn) {
  glob('**', {cwd: source, dot: true}, function(err, files) {
    fn(err, files);
  });
}
463312
static Collection<Path> findFiles(Path dir) {
		return toPaths(dir.toFile().listFiles((FileFilter) FileFileFilter.FILE));
	}
406957
static public void scanRoot(File root,
                                Set<String> suffixes,
                                List<String> excludes,
                                List<String> includes,
                                Map<String,Source> foundFiles,
                                Map<String,Module> foundModules,
                                final Module currentModule,
                                boolean permitSourcesWithoutPackage,
                                boolean inGensrc,
                                boolean inLinksrc)
                                        throws IOException, ProblemException {

        if (root == null)
            return;

        FileSystem fs = root.toPath().getFileSystem();

        if (includes.isEmpty()) {
            includes = Collections.singletonList("**");
        }

        List<PathMatcher> includeMatchers = createPathMatchers(fs, includes);
        List<PathMatcher> excludeMatchers = createPathMatchers(fs, excludes);

        Files.walkFileTree(root.toPath(), new SimpleFileVisitor<Path>() {
            @Override
            public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {

                Path relToRoot = root.toPath().relativize(file);

                if (includeMatchers.stream().anyMatch(im -> im.matches(relToRoot))
                        && excludeMatchers.stream().noneMatch(em -> em.matches(relToRoot))
                        && suffixes.contains(Util.fileSuffix(file))) {

                    // TODO: Test this.
                    Source existing = foundFiles.get(file);
                    if (existing != null) {
                        throw new IOException("You have already added the file "+file+" from "+existing.file().getPath());
                    }
                    existing = currentModule.lookupSource(file.toString());
                    if (existing != null) {

                            // Oups, the source is already added, could be ok, could be not, lets check.
                            if (inLinksrc) {
                                // So we are collecting sources for linking only.
                                if (existing.isLinkedOnly()) {
                                    // Ouch, this one is also for linking only. Bad.
                                    throw new IOException("You have already added the link only file " + file + " from " + existing.file().getPath());
                                }
                                // Ok, the existing source is to be compiled. Thus this link only is redundant
                                // since all compiled are also linked to. Continue to the next source.
                                // But we need to add the source, so that it will be visible to linking,
                                // if not the multi core compile will fail because a JavaCompiler cannot
                                // find the necessary dependencies for its part of the source.
                                foundFiles.put(file.toString(), existing);
                            } else {
                                // We are looking for sources to compile, if we find an existing to be compiled
                                // source with the same name, it is an internal error, since we must
                                // find the sources to be compiled before we find the sources to be linked to.
                                throw new IOException("Internal error: Double add of file " + file + " from " + existing.file().getPath());
                            }

                    } else {

                        //////////////////////////////////////////////////////////////
                        // Add source
                        Source s = new Source(currentModule, file.toString(), file.toFile());
                        if (inGensrc) {
                            s.markAsGenerated();
                        }
                        if (inLinksrc) {
                            s.markAsLinkedOnly();
                        }
                        String pkg = packageOfJavaFile(root.toPath(), file);
                        pkg = currentModule.name() + ":" + pkg;
                        foundFiles.put(file.toString(), s);
                        currentModule.addSource(pkg, s);
                        //////////////////////////////////////////////////////////////
                    }
                }

                return FileVisitResult.CONTINUE;
            }
        });
    }
1233942
def _get_files_recursively(rootdir):
    
    output = []
    for root, dirs, files in os.walk(rootdir):
        for filename in files:
            output.append(os.path.join(root, filename))

    return output
922010
private static Set<String> findFiles(File sourceFolder, File baseFile) {
		Set<String> retval = new HashSet<String>();
		if (!sourceFolder.exists() || sourceFolder.isHidden()
				|| !sourceFolder.isDirectory() || !sourceFolder.canRead()
				|| isGitMetaDataFolder(sourceFolder)) {
			return retval;
		}
		for (File file : sourceFolder.listFiles()) {
			if (file.isDirectory()) {
				retval.addAll(findFiles(file, sourceFolder));
			} else {
				retval.add(file.getAbsolutePath());
			}
		}
		return retval;
	}
395873
def get_files(directory, recursive=False):
    """"""
    files_out = []
    if recursive:
        for root, dirs, files in os.walk(os.path.abspath(directory)):
            files = [os.path.join(root, f) for f in files]
            files_out.append(files)
        files_out = list(itertools.chain(*files_out))
    else:
        files_out = [os.path.join(directory, f) for f in os.listdir(directory)]
        files_out = list(filter(lambda f: os.path.isfile(f), files_out))

    # order alphabetically on file name
    return sorted(files_out)
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;
    }
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)
737230
def findall(dir=os.curdir):
    
    files = _find_all_simple(dir)
    if dir == os.curdir:
        make_rel = functools.partial(os.path.relpath, start=dir)
        files = map(make_rel, files)
    return list(files)
815122
private static String recursiveSearch(java.io.File dir, String fileName) {
        for (String name : dir.list()) {
            java.io.File file = new java.io.File(dir.getAbsolutePath() + "/" + name);
            if (name.compareTo(fileName) == 0) return file.getAbsolutePath();
            if (file.isDirectory()) {
                String filePath = recursiveSearch(file, fileName);
                if (filePath != null) return filePath;
            }
        }

        return null;
    }