File directory=new File("directory path"); int fileCount=directory.list().length; System.out.println("File Count:"+fileCount);