Project

General

Profile

Feature #10121

Updated by nobu (Nobuyoshi Nakada) about 3 years ago

On IRC someone asked how to find out if a directory is empty or not, from within ruby.

It seems as if there was no simple way.

I suggest adding `Dir.empty?` Dir.empty?

On IRC, someone else suggested this:

~~~ruby


Dir.entries(dir).size == 2
~~~


I do not know if there are better ways but possibly that could
be used for a `Dir.empty?` Dir.empty? functionality?

Back