The code below prints all the directories and files under supplied directory name.

Java Code:
private static void listAll(String dirName) {

        System.out.println();
        System.out.println("Simple file listing...");
        System.out.println("----------------------");

        File dir = new File(dirName);
        
        String[] children = dir.list();

        printFiles(children, dirName);

    }