From: Robert Sheehan Date: 2007-04-09T05:05:03+09:00 Subject: Re: File.delete -> Permission denied Antoine De Groote wrote: > The following code (on Windows XP, Ruby 1.8.5): > > Dir.chdir 'c:/documents and settings/antoine/desktop' > Dir.mkdir 'test' > Dir.chdir 'test' > %w{ a b c }.each { |f| File.open(f+'.txt', 'w').close } > Dir.foreach('.') { |f| File.delete f } > > throws this error message: > > problem.rb:5:in `delete': Permission denied - . (Errno::EACCES) > from problem.rb:5 > from problem.rb:5:in `foreach' > from problem.rb:5 Dir.foreach also returns '.' and '..'. The error message is saying you can't delete the current directory (it still contains files).