From: WATANABE Hirofumi Date: 2006-10-17T01:52:37+09:00 Subject: Re: Test if Directory is Empty Hi, Nobuyoshi Nakada writes: > At Mon, 16 Oct 2006 23:19:30 +0900, > ara.t.howard@noaa.gov wrote in [ruby-talk:220018]: > > which someone will probably compact... note that it returns false when the > > first file/dotfile is found. > > !Dir.foreach(dirname) {|n| break true unless /\A\.\.?\z/ =~ n} > !Dir.enum_for(:foreach, dirname).any? {|n| /\A\.\.?\z/ !~ n} Dir.entries(dirname).join == "..." -- eban