From: Bertram Scharpf Date: 2007-08-14T22:08:58+09:00 Subject: Re: Non Existent Method Dir.empty? Description via "ri" Hi, Am Dienstag, 14. Aug 2007, 21:58:17 +0900 schrieb John Joyce: > You might want to use something like this: > > def dir_empty?(path_to_dir) > Dir.chdir(path_to_dir) > if Dir.glob('*').length > 0 > return false > else > return true > end What's this? 1. 'end' is missing. 2. 'if ... then false else true end' is a lot of hot air around 'not ...'. 3. As a side effect the method changes the current directory. Say def dir_empty? path_to_dir Dir.chdir path_to_dir do not Dir.glob('*').length > 0 end end Then, you may consider hidden files ... First think, then write. Sorry! Bertram -- Bertram Scharpf Stuttgart, Deutschland/Germany http://www.bertram-scharpf.de