Java tutorial
//package com.java2s; import java.io.File; public class Main { public static void ls(String path) { int seq = 0; File[] child = null; try { File dir = new File(path); child = dir.listFiles(); } catch (Exception e) { child = null; } System.out.println("Listing of: " + path); if (child == null) { // AqLog.getInstance().info("No files to delete. srcDir: " + srcDir + ", pattern: " + pattern ); //System.out.println("No files to delete. srcDir: " + srcDir + ", pattern: " + pattern ); } else { for (int i = 0; i < child.length; i++) { System.out.println(child[i].getName()); } } System.out.println("end of listing: " + path); } }