Pages

Categories

How to list all files in a directory in java

In today’s post we are going to learn how to list all files in a directory in java.

List all files in directory

To list all files in directory we are going to use class File which has list() method which return a lazily populated Stream, the elements of which are the entries in the directory. The listing is not recursive.