Yields absolute paths to the given file or directory. If a directory is supplied
 the method will recurse into the sub directories and ultimately yield
 every file contained within the directory and its children.
501590
def resolve_files(file_or_dir_path, options = {}, &block)
      options = {
        # Set to :template when calling to consider references to template
        # files from an import library
        import: false
      }.merge(options)
      [file_or_dir_path].flatten.each do |file_or_dir_path|
        path = inject_import_path(file_or_dir_path, type: options[:import]) if options[:import]
        path = clean_path_to(file_or_dir_path, options)
        self.base_directory = path unless options[:internal_call]
        if path.directory?
          Dir.glob("#{path}/*").sort.each do |file|
            resolve_files(file, { internal_call: true }.merge(options), &block)
          end
        else
          # Ignore files with the given prefix if supplied, but only if this is a file that
          # has been found, if explicitly asked to compile a file from the caller do it regardless
          if options[:ignore_with_prefix] && options[:internal_call]
            return nil if path.basename.to_s =~ /^#{options[:ignore_with_prefix]}/
          end
          yield path
        end
      end
    end
1106061
def walk(self, root):
        
        files = []
        folders = []
        
        for relpath in self.listdir(root):
            if self.isfile(root + '/' + relpath):
                files.append(relpath)
            else:
                folders.append(relpath)
        
        yield root, folders, files
        
        for folder in folders:
            folderpath = root + '/' + folder
            for sub_root, sub_folders, sub_files in self.walk(folderpath):
                yield sub_root, sub_folders, sub_files
818577
def iterdir(self):
        
        if self._closed:
            self._raise_closed()
        for name in self._accessor.listdir(self):
            if name in ('.', '..'):
                # Yielding a path object for these makes little sense
                continue
            yield self._make_child_relpath(name)
            if self._closed:
                self._raise_closed()
867616
def walk(self, walk_folders=False, walk_files=False):
        

        if not walk_files and not walk_folders:
            return

        for root, _, a_files in os.walk(self.folder.path, followlinks=True):
            folder = Folder(root)
            if walk_folders:
                yield folder
            if walk_files:
                for a_file in a_files:
                    if (not self.pattern or fnmatch.fnmatch(a_file,
                                                            self.pattern)):
                        yield File(folder.child(a_file))
801673
def find_files_for_use(self, all_files):
        
        for path in all_files:
            # Find the path relative to the parent dir
            relpath = self.relpath_for(path)

            # Don't care about the ./
            if relpath.startswith("./"):
                relpath = relpath[2:]

            # Only care about paths that aren't filtered
            if not self.is_filtered(relpath):
                yield Path(path, relpath)
429775
def find_files(self):
        ''''''
        for path in self.paths:
            for subpath, dirs, files in os.walk(path):
                for filename in files:
                    (name, ext) = os.path.splitext(filename)
                    if ext in self.extensions:
                        yield os.path.join(subpath, filename)
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
322715
def list_all_directories(self):
        
        def list_dirs_recursively(directory):
            if directory == self.filesystem:
                yield directory
            d_gen = itertools.chain(
                directory.directories,
                *tuple(list_dirs_recursively(d)
                       for d in directory.directories))
            for d in d_gen:
                yield d
        return list_dirs_recursively(self.filesystem)
631417
def find_files(directory, pattern):
    
    for root, __, files in os.walk(directory):
        for basename in files:
            if fnmatch.fnmatch(basename, pattern):
                filename = os.path.join(root, basename)
                yield filename
404652
def _get_files(self) -> Iterator[str]:
        
        path = os.path.abspath(self.path)
        if os.path.isfile(path):
            path = os.path.dirname(path)

        for path in self._get_parents(path):
            for file_path in self._get_files_from_dir(path):
                yield file_path
704197
def recursive_include(self, dir, pattern):
        
        full_pattern = os.path.join(dir, '**', pattern)
        found = [f for f in glob(full_pattern, recursive=True)
                 if not os.path.isdir(f)]
        self.extend(found)
        return bool(found)
1278036
private static List<File> findFiles(final File parent, boolean recurse) {
        final List<File> result = new ArrayList<>();
        if (parent.isDirectory()) {
            File[] files = parent.listFiles();
            files = (files != null ? files : new File[0]);
            for (File child : files) {
                if (child.isFile() && child.getName().endsWith(".java")) {
                    result.add(child);
                }
            }
            if (recurse) {
                for (File child : files) {
                    if (child.isDirectory() && child.getName().startsWith(".") == false) {
                        result.addAll(findFiles(child, recurse));
                    }
                }
            }
        } else {
            if (parent.getName().endsWith(".java")) {
                result.add(parent);
            }
        }
        return result;
    }
13610
def recursive_generate_copy_in(copy_in, current_path)
      limited_files_of(current_path) { |file| copy_in << file }
      directories_of(current_path) do |dir|
        recursive_generate_copy_in(copy_in, ::File.join(dir))
      end
      true
    end
382463
def dir_files(dir)
      Find.find(dir).to_a.reject!{|f| File.directory?(f) }
    end
749302
def iter_directory(directory):
    """"""
    for path, dir, files in os.walk(directory):
        for f in files:
            filepath = os.path.join(path, f)
            key = os.path.relpath(filepath, directory)
            yield (filepath, key)
1336684
def make_subdirs(self):
        """"""
        # Pull off everything below the root.
        subpath = self.full_path[len(self.context.root):]
        log.debug("make_subdirs: subpath is %s", subpath)
        # Split on directory separators, but drop the last one, as it should
        # be the filename.
        dirs = subpath.split(os.sep)[:-1]
        log.debug("dirs is %s", dirs)
        current = self.context.root
        for dir in dirs:
            if dir:
                current = os.path.join(current, dir)
                if os.path.isdir(current):
                    log.debug("%s is already an existing directory", current)
                else:
                    os.mkdir(current, 0o700)
400143
private function paths(): \Generator
    {
        foreach ($this->directories() as $root => $directory) {
            foreach ($directory as $file) {
                if (preg_match(self::PATTERN, $file->getFilename()) === 1) {
                    yield $root => $file->getPathname();
                }
            }
        }
    }