Get the files list from directory.

@param directory The directory reference (must not be <code>null</code>).
@return The directory content.
@throws LionEngineException If invalid argument or not a directory.
556797
public static List<File> getFiles(File directory)
    {
        Check.notNull(directory);

        if (directory.isDirectory())
        {
            final File[] files = directory.listFiles();
            if (files != null)
            {
                return Arrays.asList(files);
            }
        }
        throw new LionEngineException(ERROR_DIRECTORY + directory.getPath());
    }
1189177
public static List<File> getDirectories(File root) {
        if (root == null)
            return Collections.emptyList();

        FileFilter filter = new DirsOnlyFilter();

        File fileList[] = root.listFiles(filter);

        if (fileList == null)
            return Collections.emptyList();
        else
            return Arrays.asList(fileList);
    }
126476
protected function listDirectoryContents($directory = '.')
    {
        if ($directory && strpos($directory, '.') !== 0) {
            ftp_chdir($this->getConnection(), $directory);
        }

        $listing = @ftp_rawlist($this->getConnection(), '.') ?: [];

        $this->setConnectionRoot();

        return  $this->normalizeDirectoryListing($listing);
    }
1150780
@NullSafe
  private File validateDirectory(File directory) {
    return Optional.ofNullable(directory).filter(File::isDirectory)
      .orElseThrow(() -> newIllegalArgumentException("File [%s] is not a valid directory", directory));
  }
639660
private void listDirectory(File directory,
                               RelativeDirectory subdirectory,
                               Set<JavaFileObject.Kind> fileKinds,
                               boolean recurse,
                               ListBuffer<JavaFileObject> resultList) {
        File d = subdirectory.getFile(directory);
        if (!caseMapCheck(d, subdirectory))
            return;

        File[] files = d.listFiles();
        if (files == null)
            return;

        if (sortFiles != null)
            Arrays.sort(files, sortFiles);

        for (File f: files) {
            String fname = f.getName();
            if (f.isDirectory()) {
                if (recurse && SourceVersion.isIdentifier(fname)) {
                    listDirectory(directory,
                                  new RelativeDirectory(subdirectory, fname),
                                  fileKinds,
                                  recurse,
                                  resultList);
                }
            } else {
                if (isValidFile(fname, fileKinds)) {
                    JavaFileObject fe =
                        new RegularFileObject(this, fname, new File(d, fname));
                    resultList.append(fe);
                }
            }
        }
    }
60001
private static List<String> getResourcesFromDirectory(final File directory, final Pattern searchPattern) {
        final List<String> resources = new ArrayList<>();

        // Filter only properties files
        final File[] fileList = directory.listFiles();

        if (fileList != null && fileList.length > 0) {
            // Iterate over each relevant file
            for (final File file : fileList) {
                // If the file is a directory process a recursive call to explorer the tree
                if (file.isDirectory()) {
                    resources.addAll(getResourcesFromDirectory(file, searchPattern));
                } else {
                    try {
                        checkResource(resources, searchPattern, file.getCanonicalPath());
                    } catch (final IOException e) {
                        LOGGER.log(BAD_CANONICAL_PATH, e);
                    }
                }
            }
        }
        return resources;
    }
411408
protected final boolean tryFS(String directory){
		String path = directory;
		File file = new File(path);
		if(this.testDirectory(file)==true){
			//found in file system
			try{
				this.url = file.toURI().toURL();
				this.file = file;
				this.fullDirectoryName = FilenameUtils.getPath(file.getAbsolutePath());
				this.setRootPath = directory;
				return true;
			}
			catch (MalformedURLException e) {
				this.errors.addError("init() - malformed URL for file with name " + this.file.getAbsolutePath() + " and message: " + e.getMessage());
			}
		}
		return false;
	}
1371424
public File[] listFiles(String directoryPath) {
        File[] result = null;
        File directory = null;
        directory = new File(directoryPath);
        if (directory.isDirectory()) {
            result = directory.listFiles();
        }
        return result;
    }
408859
public final Collection<File> findFiles(File directory, FileFilter filter) {
		final Collection<File> files = new ArrayList<>();
		findFiles(directory, filter, files);
		return files;
	}
847198
public static final File[] findJarFileByDir(File dir)
	{
		if(dir==null)
		{
			throw new NullArgumentException("dir ==null");
		}
		if(dir.isFile())
		{
			throw new IllegalArgumentException("dir "+dir+" is not a dir");
		}
		if(!dir.exists())
		{
			throw new IllegalArgumentException("dir "+dir+" not found");
		}
		File[] jarFiles = dir.listFiles(new FileFilter() {
			@Override
			public boolean accept(File pathname) 
				{
					return pathname.getName().endsWith(".jar");
				}
			});
		return jarFiles;
	}
1166632
public static ArrayList<File> getFilesInDirectoryTree(String path) {
		File directory = new File(path);
		return getContentsInDirectoryTree(directory, "*", true, false);
	}
1244760
public static void loadLibraryFromFile(final String directory, final String filename) throws IOException {

		final String libraryPath = directory + File.separator + filename;

		synchronized (loadedLibrarySet) {

			final File outputFile = new File(directory, filename);
			if (!outputFile.exists()) {

				// Try to extract the library from the system resources
				final ClassLoader cl = ClassLoader.getSystemClassLoader();
				final InputStream in = cl.getResourceAsStream(JAR_PREFIX + filename);
				if (in == null) {
					throw new IOException("Unable to extract native library " + filename + " to " + directory);
				}

				final OutputStream out = new FileOutputStream(outputFile);
				copy(in, out);
			}

			System.load(libraryPath);
			loadedLibrarySet.add(filename);
		}
	}
79873
public static boolean createOrCleanDirectory(String directory) {
    // if the directory does not exist, create it.
    if (!FileUtils.isDirectoryExists(directory)) {
      LOG.fine("The directory does not exist; creating it.");
      if (!FileUtils.createDirectory(directory)) {
        LOG.severe("Failed to create directory: " + directory);
        return false;
      }
    }

    // Cleanup the directory
    if (!FileUtils.cleanDir(directory)) {
      LOG.severe("Failed to clean directory: " + directory);
      return false;
    }

    return true;
  }
871076
public static long getDU(File dir) {
    long size = 0;
    if (!dir.exists())
      return 0;
    if (!dir.isDirectory()) {
      return dir.length();
    } else {
      size = dir.length();
      File[] allFiles = dir.listFiles();
      for (int i = 0; i < allFiles.length; i++) {
        size = size + getDU(allFiles[i]);
      }
      return size;
    }
  }
1167320
def list_files(directory):
    
    return [f for f in pathlib.Path(directory).iterdir() if f.is_file() and not f.name.startswith('.')]
785152
private static String checkFolder(String directory) {
        File dir = new File(directory);
        if (dir.isFile()) {
            directory = dir.getParent();
        }
        createFolder(directory);
        return directory;
    }
497376
public static void checkDirectory(File directory) {
        if (!(directory.exists() || directory.mkdirs())) {
            throw new ReportGenerationException(
                    String.format("Can't create data directory <%s>", directory.getAbsolutePath())
            );
        }
    }