Transform all of the files in a directory recursively.
193046
function transformDir ({ config, entry, outdir }) {
  return glob.sync(`${entry[0]}/**/*.js`).map(filename =>
    transformFile({
      config,
      entry: [filename, filename.replace(entry[0], entry[1] || outdir)]
    })
  )
}
1092172
def makedirs(path):
    """"""
    path = Path(path)

    if not path.exists():
        path.mkdir(parents=True)
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
318758
private void addFilesFromDir(File dir) {
    File[] files = dir.listFiles();
    for (int i = 0; i < files.length; i++) {
      if (!files[i].isDirectory()) {
        mFiles.add(files[i]);
      } else if (mRecursive) {
        addFilesFromDir(files[i]);
      }
    }
  }
197483
def prune(self, dir):
        """"""
        match = translate_pattern(os.path.join(dir, '**'))
        return self._remove_files(match.match)
129496
async function filesInDirectories(dirPaths, options) {
  let files = await Promise.all(makeArray(dirPaths).map(dirPath=>_filesInDirectory(dirPath, options)));
  return flattenDeep(files);
}
1077193
def expand_dirs_to_files(*dirs)
      extensions = %w[rb erb rake rhtml haml slim builder rxml rabl]

      dirs.flatten.map do |entry|
        next unless File.exist? entry

        if File.directory? entry
          Dir[File.join(entry, '**', "*.{#{extensions.join(',')}}")]
        else
          entry
        end
      end.flatten
    end
461866
private function directories(): \Generator
    {
        foreach ($this->directories as $root) {
            if (is_dir($root)) {
                yield $root => new \RecursiveIteratorIterator(
                    new \RecursiveDirectoryIterator($root)
                );
            }
        }
    }
743702
def generate_from_directory(cls, directory):
        
        files = [os.path.join(directory, f) for f in os.listdir(directory)
                 if os.path.isfile(os.path.join(directory, f))]
        return cls(files)
1097332
def mkdir(path, recursive=True, **kwargs):
    """"""
    import os
    if recursive:
        os.makedirs(path, **kwargs)
    else:
        os.mkdir(path, **kwargs)
741027
function transformFile(from, to, modulesDirectory) {
  var contents = fs.readFileSync(from, 'utf8');

  // modules
  var modules = getModules(contents);
  for (var index in modules) {
    var module = modules[index];
    if (modulesManifest.hasOwnProperty(module)) {
      continue;
    }
    var modulePath = path_util.modulePath(module, node_modules);
    if (modulePath === null) {
      continue;
    }
    var targetPath = path_util.targetPath(modulePath, node_modules, modulesDirectory);
    modulesManifest[module] = path.relative(process.cwd(), targetPath);
    if (!fs.existsSync(targetPath)) {
      transformFile(modulePath, targetPath, modulesDirectory);
    }
    var relativePath = path_util.relativePath(to, targetPath);
    var re = eval('\/require\\\(\[\'\"\]' + module + '\[\'\"\]\\\)\/ig');
    contents = contents.replace(re, 'require(\'' + relativePath + '\')');
  }

  // requires
  var requires = getRequires(contents);
  for (var index in requires) {
    var require = requires[index];
    var requirePath = path_util.requirePath(from, require);
    if (requirePath === null) {
      continue;
    }
    if (requiresManifest.hasOwnProperty(requirePath)) {
      continue;
    } else {
      requiresManifest[requirePath] = true;
    }
    var targetPath = path_util.targetPath(requirePath, node_modules, modulesDirectory);
    if (!fs.existsSync(targetPath)) {
      transformFile(requirePath, targetPath, modulesDirectory);
    }
  }

  var dirname = path.dirname(to);
  fs.mkdirsSync(dirname);
  fs.writeFileSync(to, contents, 'utf8');
}
656979
def itersubdirs(self, pattern=None, abspath=False):
        
        if pattern is not None:
            globster = Globster([pattern])
        for root, dirs, files in self.walk():
            for d in dirs:
                if pattern is None or (pattern is not None and globster.match(d)):
                    if abspath:
                        yield os.path.join(root, d)
                    else:
                        yield self.relpath(os.path.join(root, d))
800502
async def transform(self, file):
		""""""
		path = get_path(self.dest, file)
		await self.loop.run_in_executor(self.exe, write_file, path, file.contents)
		return file
305823
private static Set<File> findAllFiles(File dir) {
        Set<File> foundFiles = new HashSet<>();
        if (dir == null) {
            return foundFiles;
        }
        recurse(dir, foundFiles);
        return foundFiles;
    }
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)
166232
def reconstruct_files(input_dir):
    ''''''
    input_dir = input_dir.rstrip('/')
    with nl.notify('Attempting to organize/reconstruct directory'):
        # Some datasets start with a ".", which confuses many programs
        for r,ds,fs in os.walk(input_dir):
            for f in fs:
                if f[0]=='.':
                    shutil.move(os.path.join(r,f),os.path.join(r,'i'+f))
        nl.dicom.organize_dir(input_dir)
        output_dir = '%s-sorted' % input_dir
        if os.path.exists(output_dir):
            with nl.run_in(output_dir):
                for dset_dir in os.listdir('.'):
                    with nl.notify('creating dataset from %s' % dset_dir):
                        nl.dicom.create_dset(dset_dir)
        else:
            nl.notify('Warning: failed to auto-organize directory %s' % input_dir,level=nl.level.warning)
1038163
def replace_folder(path):
    """"""
    if os.path.exists(path):
        shutil.rmtree(path)
        os.makedirs(path)
    else:
        os.makedirs(path)