Java Folder Read getFiles(String directoryPath)

Here you can find the source of getFiles(String directoryPath)

Description

Return list of files in given directory

License

Open Source License

Parameter

Parameter Description
directoryPath a parameter

Declaration

public static String[] getFiles(String directoryPath) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.File;

public class Main {
    /**// ww  w  . j  a v  a  2  s. co m
     * Return list of files in given directory
     * 
     * @param directoryPath
     * @return
     */
    public static String[] getFiles(String directoryPath) {
        File dir = new File(directoryPath);
        if (dir.exists()) {
            return dir.list();
        }
        return null;
    }
}

Related

  1. getFiles(List l, String directory)
  2. getFiles(String _path)
  3. getFiles(String dir)
  4. getFiles(String dir)
  5. getFiles(String dir)
  6. getFiles(String dirName, int number)
  7. getFiles(String folderName, String prefix)
  8. getFiles(String parent)
  9. getFiles(String path)