Here you can find the source of getFileNamesFromDir(File rootDir, String indexName)
Parameter | Description |
---|---|
rootDir | the root directory. |
indexName | the name of the subdirectory. |
public static String[] getFileNamesFromDir(File rootDir, String indexName)
//package com.java2s; //License from project: Apache License import java.io.File; public class Main { /**/* www . ja va2 s . c o m*/ * Returns the list of file names in the specified directory. * * @param rootDir the root directory. * @param indexName the name of the subdirectory. * @return the array of the names of the files. */ public static String[] getFileNamesFromDir(File rootDir, String indexName) { File indexDir = new File(rootDir.getAbsoluteFile(), indexName); assert indexDir.exists(); String[] fileNames = indexDir.list(); assert fileNames.length > 0; return fileNames; } }