This is an internal method to create the list of input files (or directories)
        contained in the provided directory or directories.
503369
def createList(self,args):
        
        resultList = []
        if len(args.path) == 1 and os.path.isdir(args.path[0]):
            resultList = [os.path.join(args.path[0], f) for f in os.listdir(args.path[0])]
        else:    # If there are multiple items, wildcard expansion has already created the list of files
            resultList = args.path
        return list(set(resultList))
988115
private static void createInputDirectory(FileSystem fs, 
                                           Path dir,
                                           Pentomino pent,
                                           int depth
                                           ) throws IOException {
    fs.mkdirs(dir);
    List<int[]> splits = pent.getSplits(depth);
    PrintStream file = 
      new PrintStream(new BufferedOutputStream
                      (fs.create(new Path(dir, "part1")), 64*1024));
    for(int[] prefix: splits) {
      for(int i=0; i < prefix.length; ++i) {
        if (i != 0) {
          file.print(',');          
        }
        file.print(prefix[i]);
      }
      file.print('\n');
    }
    file.close();
  }
523353
public static File[] listRepositories(File parent) {
        if (parent == null) {
            throw new IllegalArgumentException("Input parameter can't be null.");
        }
        parent = checkKnownType(parent);
        if (!parent.isDirectory()) {
            throw new IllegalArgumentException("Input parameter should be an existing directory: " + parent);
        }
        File[] result = parent.listFiles(new FileFilter() {
            @Override
            public boolean accept(File pathname) {
                return pathname.isDirectory() &&
                       getChild(pathname, LogRepositoryBrowserImpl.DEFAULT_LOCATION).isDirectory() ||
                       getChild(pathname, LogRepositoryBrowserImpl.TRACE_LOCATION).isDirectory();
            }
        });
        return result == null ? new File[] {} : result;
    }
808460
def mkdir(dirname):
    
    dir_list = []

    while not client.isdir(dirname):
        dir_list.append(dirname)
        dirname = os.path.dirname(dirname)
    while len(dir_list) > 0:
        logging.info("Creating directory: %s" % (dir_list[-1]))
        try:
            client.mkdir(dir_list.pop())
        except IOError as e:
            if e.errno == errno.EEXIST:
                pass
            else:
                raise e
775402
def move_files_to_folders(directory):
    
    # Generate lists of files and folders in root directory
    files, folders, files_to_move = [], [], []
    for path in os.listdir(directory):
        if os.path.isdir(path):
            folders.append(path)
        elif os.path.isfile(path):
            files.append(path)

    # Loop through folders in root directory
    for path in folders:
        # Generate list of files with same prefix as current folder
        child_files = [f for f in files if f.startswith(path)]
        files_to_move.append((path, child_files))

    # Move child files into parent folder
    for each in files_to_move:
        folder, files = each
        for f in files:
            shutil.move(f, folder)
392609
List<File> getFiles() {
        List<File> list = new ArrayList<File>();
        for (String sDirectory : config.getDirectories()) {
            if (sDirectory != null) {
                File directory = getDirectory(sDirectory);
                File[] aFiles = directory.listFiles(config.getFilenameFilter());
                if (aFiles != null) {
                    list.addAll(Arrays.asList(aFiles));
                }
            }
        }
        return list;
    }
548740
private void processPlainFileSources(URI inputURI) throws IOException {
    LOG.info("Scheme specific part is: " + inputURI.getSchemeSpecificPart());

    File inputFile = new File(inputURI.getSchemeSpecificPart());

    // Check if input is a directory
    if (!inputFile.isDirectory()) {
      throw new IOException("Input is not a regular directory: " + input);
    }

    File[] files = inputFile.listFiles();
    int processedCount = 0;
    try {
      for (File f : files) {
        // Process only files, not (sub)directories.
        if (f.isFile()) {
          processPlainFile(hdfs, f, outputPath, skipExisting);
          processedCount++;
          // Print something each 100 files to show progress.
          if ((processedCount % 1000) == 0) {
            LOG.info("Processed " + processedCount + " files.");
          }
        }
      }
    } finally {
      LOG.info("Processed " + processedCount + " files.");
    }
  }
1103226
def input_files(self):
        
        return self.workspace.mets.find_files(fileGrp=self.input_file_grp, pageId=self.page_id)
723451
@Override
	public FileInputSplit[] createInputSplits(int minNumSplits) throws IOException {
		int numAvroFiles = 0;
		final Path path = this.filePath;
		// get all the files that are involved in the splits
		final FileSystem fs = path.getFileSystem();
		final FileStatus pathFile = fs.getFileStatus(path);

		if (!acceptFile(pathFile)) {
			throw new IOException("The given file does not pass the file-filter");
		}
		if (pathFile.isDir()) {
			// input is directory. list all contained files
			final FileStatus[] dir = fs.listStatus(path);
			for (int i = 0; i < dir.length; i++) {
				if (!dir[i].isDir() && acceptFile(dir[i])) {
					numAvroFiles++;
				}
			}
		} else {
			numAvroFiles = 1;
		}
		return super.createInputSplits(numAvroFiles);
	}
1036687
function createDirectories(done) {
		debug('createDirectories()');
		var paths = [ options.output ];
		function iterator(dirpath, next) { mkdirp(dirpath, '0755', next); };
		async.forEach(paths, iterator, done);
	}
374350
def get_valid_directory_list(input_directory):
    
    valid_input_directories = []
    for directory in os.listdir(input_directory):
        if os.path.isdir(os.path.join(input_directory, directory)):
            valid_input_directories.append(directory)
        else:
            print("{0} not a directory. Skipping ...".format(directory))
    return valid_input_directories
326755
function createListOfDirectories(prev, dir) {
  return {
    ...prev,
    [dir.split(path.sep).pop()]: dir,
  }
}
47739
def create_inputlist(arglist):
    
    lines = []
    if isinstance(arglist, list):
        for arg in arglist:
            if os.path.splitext(arg)[1] == '.lst':
                lines += readlines(arg)
            else:
                lines.append(arg)
    elif is_null(arglist):
        pass
    else:
        if os.path.splitext(arglist)[1] == '.lst':
            lines += readlines(arglist)
        else:
            lines.append(arglist)
    return lines
1107511
def addList(self, source_id, dir_path, is_recurcive=False, timestamp_reception=None, training_metadata=[]):
        """"""
        if not path.isdir(dir_path):
            raise ValueError(dir_path + ' is not a directory')
        files_to_send = _get_files_from_dir(dir_path, is_recurcive)
        succeed_upload = {}
        failed_upload = {}
        for file_path in files_to_send:
            try:
                resp = self.add(source_id=source_id,
                    file_path=file_path, profile_reference="",
                    timestamp_reception=timestamp_reception, training_metadata=training_metadata)
                if resp['code'] != 200 and resp['code'] != 201:
                    failed_upload[file_path] = ValueError('Invalid response: ' + str(resp))
                else:
                    succeed_upload[file_path] = resp
            except BaseException as e:
                failed_upload[file_path] = e
        result = {
            'success': succeed_upload,
            'fail': failed_upload
        }
        return result
682232
def add_data_files(*include_dirs):
    ''
    data_files = []
    for include_dir in include_dirs:
        for root, directories, filenames in os.walk(include_dir):
            include_files = []
            for filename in filenames:
                # do not bring along certain files
                if filename.endswith('.local'):
                    continue
                include_files.append(os.path.join(root, filename))
            if include_files:
                data_files.append((root, include_files))
    return data_files
196891
def build(self, *args, **kwargs):
        
        # Create dirs for input, output and tmp data.
        self.indir.makedirs()
        self.outdir.makedirs()
        self.tmpdir.makedirs()

        # Write files file and input file.
        if not self.files_file.exists:
            self.files_file.write(self.filesfile_string)

        self.input_file.write(self.make_input())
        self.manager.write_jobfile(self)
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)