Check Directory Empty Java

Check Directory Empty Java

If you want to search directory and check if it is empty or not using java please have sample program below. We will use jdk 7 Files.newDirectoryStream open directory and use iterator to check if it is empty or not.

  • Sample java program:

  • Output:

2014-11-30_1205

For more information about Files API please check oracle documentation here

Leave a Reply

Your email address will not be published. Required fields are marked *