Fetches files from the target directory, and - if recursive
            mode is on, all subdirectories.

            Returns a list of all found files
329168
def _fetchFilesFromFolder(self, target, recursive):
        '''
            
        '''
        directory_items = os.walk(target)

        # If recursive is false, fetch only the first tuple
        if not recursive:
            directory_items = [next(directory_items)]

        targets = []
        for dir_name, folders, files in directory_items:
            for f in files:
                targets.append(os.path.join(dir_name, f))

        return targets
1157168
def getFiles(self,args):
        
        fileList = []
        if args.recursive:    # The list is created by going through the folder(s) recursively:
            fileList = self.createListRecursively(args)
        else:    # The list is created by going through the provided folder(s):
            fileList = self.createList(args)
        if args.directories:
            # If directories are returned, the list is sorted in reverse order.
            # This allows the processing of subfolders before the processing of the parent folder.
            # Processing the parent folder first may not work because the command may remove
            # or rename the folder, which would affect the subfolders.
            fileList = [element for element in fileList if os.path.isdir(element)]
            return sorted(fileList,reverse=True)
        else:
            # Filter out all directories:
            fileList = [element for element in fileList if os.path.isfile(element)]
	    if args.extensions != None:    # Files are filtered based on their extensions:
                extensionList = self.getExtensionList(args.extensions)
                fileList = [element for element in fileList if os.path.splitext(element)[1] in extensionList]
            # The files in the list are sorted in lexicographical order:
            return sorted(fileList)
519934
def find_all_files(self):
		
		files = self.find_files()
		subrepo_files = (
			posixpath.join(subrepo.location, filename)
			for subrepo in self.subrepos()
			for filename in subrepo.find_files()
		)
		return itertools.chain(files, subrepo_files)
538528
function _getFiles(path){
        let files = [];
        fs.readdirSync(path).forEach(function(file){
            let subpath = path + '/' + file;
            if(fs.lstatSync(subpath).isDirectory()){
                let filesReturned = _getFiles(subpath);
                files = files.concat(filesReturned);
            } else {
                files.push(path + '/' + file);
            }
        });
        return files;
    }
854631
def _fetchAllChildren(self):
        
        childItems = []
        fileNames = os.listdir(self._fileName)
        absFileNames = [os.path.join(self._fileName, fn) for fn in fileNames]

        # Add subdirectories
        for fileName, absFileName in zip(fileNames, absFileNames):
            if os.path.isdir(absFileName) and not fileName.startswith('.'):
                childItems.append(DirectoryRti(fileName=absFileName, nodeName=fileName))

        # Add regular files
        for fileName, absFileName in zip(fileNames, absFileNames):
            if os.path.isfile(absFileName) and not fileName.startswith('.'):
                childItem = createRtiFromFileName(absFileName)
                childItems.append(childItem)

        return childItems
1212931
def list_matching_files(dir, extensions=None, recursive=True):
    
    from .modules import utils
    return utils.list_matching_files(dir, extensions=extensions, recursive=recursive)
1178392
def get_files_recursively_from directory
        dir = Pathname.new directory
        return nil  unless (dir.directory?)
        return dir.each_child.map do |file|
          next file.realpath.to_path            if (file.file?)
          next get_files_recursively_from file  if (file.directory?)
        end .flatten
      end
1283540
def find_directories(root,fullpath=True):
    '''
    
    '''
    directories = []
    for item in os.listdir(root):
        # Don't include hidden directories
        if not re.match("^[.]",item):
            if os.path.isdir(os.path.join(root, item)):
                if fullpath:
                    directories.append(os.path.abspath(os.path.join(root, item)))
                else:
                    directories.append(item)
    return directories
1262672
def _GetSubFileEntries(self):
    
    if self._directory is None:
      self._directory = self._GetDirectory()

    if self._directory:
      for path_spec in self._directory.entries:
        yield self._file_system.GetFileEntryByPathSpec(path_spec)
995076
def all_files(file_or_directory):
    ''
    if os.path.isdir(file_or_directory):
        return [os.path.join(dirname, filename)
                for dirname, dirnames, filenames in os.walk(file_or_directory)
                for filename in filenames]
    else:
        return [file_or_directory]
250343
def files_in_subdir(dir, subdir):
    """"""
    paths = []
    for (path, dirs, files) in os.walk(os.path.join(dir, subdir)):
        for file in files:
            paths.append(os.path.relpath(os.path.join(path, file), dir))
    return paths
564967
private static Collection<File> findDirsRecursively(File dir) {
		return FileUtils.listFilesAndDirs(dir, FalseFileFilter.FALSE, TrueFileFilter.TRUE);
	}
1032347
def find_files(self):
		
		all_files = self._invoke('locate', '-I', '.').splitlines()
		# now we have a list of all files in self.location relative to
		#  self.find_root()
		# Remove the parent dirs from them.
		from_root = os.path.relpath(self.location, self.find_root())
		loc_rel_paths = [
			os.path.relpath(path, from_root)
			for path in all_files]
		return loc_rel_paths
1362173
def getSubdirectories(d):
	'''
	'''
	return [f for f in os.listdir(d) if os.path.isdir(os.path.join(d, f)) ]
276368
def get_files(self):
        
        files = {}
        for filename in os.listdir(self.source):
            path = os.path.join(self.source, filename)
            files[filename] = frontmatter.load(path, 
                filename=filename, 
                slug=os.path.splitext(filename)[0])

        return files
886170
def find_all_files(glob):
    
    for finder in finders.get_finders():
        for path, storage in finder.list([]):
            if fnmatch.fnmatchcase(os.path.join(getattr(storage, 'prefix', '')
                                                or '', path),
                                   glob):
                yield path, storage
324010
def list(path, ext=None, start=None, stop=None, recursive=False):
        
        files = listflat(path, ext) if not recursive else listrecursive(path, ext)
        if len(files) < 1:
            raise FileNotFoundError('Cannot find files of type "%s" in %s'
                                    % (ext if ext else '*', path))
        files = select(files, start, stop)

        return files