Java File List Load getFileList(String directoryPath)

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

Description

get File List

License

Open Source License

Declaration

public static String[] getFileList(String directoryPath) 

Method Source Code

//package com.java2s;
/*/*from  w  w  w  .jav  a  2 s .co m*/
 The MIT License
    
 Copyright (c) 2013 - 2013
   1. High Performance Computing Group, 
   School of Electrical Engineering and Computer Science (SEECS), 
   National University of Sciences and Technology (NUST)
   2. Khurram Shahzad, Mohsan Jameel, Aamir Shafi, Bryan Carpenter (2013 - 2013)
       
    
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the
 "Software"), to deal in the Software without restriction, including
 without limitation the rights to use, copy, modify, merge, publish,
 distribute, sublicense, and/or sell copies of the Software, and to
 permit persons to whom the Software is furnished to do so, subject to
 the following conditions:
    
 The above copyright notice and this permission notice shall be included
 in all copies or substantial portions of the Software.
    
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
 NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
 THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

import java.io.File;

public class Main {
    public static String[] getFileList(String directoryPath) {

        File directory = new File(directoryPath);

        if (directory.exists()) {
            return directory.list();
        }

        return new String[] {};
    }
}

Related

  1. getFileList(String dir)
  2. getFileList(String dir)
  3. getFileList(String dir, final String extension)
  4. getFileList(String dir, final String suffix)
  5. getFileList(String directory, String filterRegexp)
  6. getFileList(String filePath, FileFilter fileFilter, boolean recursive)
  7. getFileList(String folderPath)
  8. getFileList(String inputFilename)
  9. getFileList(String path)