From: Sandor Szuecs Date: 2011-03-03T23:35:14+09:00 Subject: Re: Finding all empty directories in a subversion checkout On Mar 3, 2011, at 2:05 AM, Adam Prescott wrote: > On Thu, Mar 3, 2011 at 1:03 AM, Adam Prescott wrote: > >> Dir.entries(dir)[2..-1].reject { |e| e == ".svn" } >> > > And of course I forgot the .sort :) > > Dir.entries(dir).sort[2..-1].reject { |e| e == ".svn" } 2..-1 is not correct. It's mostly correct, but what if valid files with name.ord < ".".ord (String#ord ruby19) exists? p.e. [sz@suessapfel:/tmp/foo]$ irb irb:0> FileUtils.touch '-r' => ["-r"] irb:0> Dir.entries(".").sort[-1..2] => [".."] irb:0> ^D[sz@suessapfel:/tmp/foo]$ l total 0 -rw------- 1 sz wheel 0B Mar 3 15:30 -r drwx------ 3 sz wheel 102B Mar 3 15:30 ./ drwxrwxrwt@ 11 root wheel 374B Mar 3 15:30 ../ All the best, Sandor Szücs --