Here you can find the source of getFileNameArrayFromDirectory(String directoryLocation)
Parameter | Description |
---|---|
directoryLocation | Target Directory. |
public static String[] getFileNameArrayFromDirectory(String directoryLocation)
//package com.java2s; /**//ww w. ja va 2 s . c om * Copyright (c) {2011} {meter@rbtsb.com} { * individual contributors as indicated by the @authors tag}. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Private License v1.0 * which accompanies this distribution, and is available at * http://www.rbtsb.com */ import java.io.File; public class Main { /** * @param directoryLocation * Target Directory. * @return Array of file Name. */ public static String[] getFileNameArrayFromDirectory(String directoryLocation) { String[] children = null; try { File dir = new File(directoryLocation); children = dir.list(); if (children == null) { children = new String[0]; } } catch (Exception e) { e.printStackTrace(); children = new String[0]; } return children; } }