Digital Marketing

How To Check If Directory Is Empty In Java

With JDK >= 7 you can use Files.newDirectoryStream to open the directory and then use the iterator's hasNext() method to test there are any files to iterator over. This should work better for huge directories or where the directory is on a remote file system when compared to the list methods.


Popular posts from this blog

Fixed WSL sshd: no hostkeys available -- exiting

PowerMTA pmta command

How to fix: mv: failed to preserve ownership